Skip to content

Undefined variable error if description contains a dollar sign #59

Description

@mrbig

Hello!

Thanks for the great package! Unfortunately I've encountered an error building a complex schema.

Given the following json schema:

{
  "type": "object",
  "description": "Description with $dollar sign",
  "properties": {
    "foo": {
      "type": "string"
    }
  }

The generated code fails with the following error:
Undefined variable: dollar

The reason behind this is that the dollar sign is not escaped:

    public static function setUpProperties($properties, Schema $ownerSchema)
    {
        $properties->foo = Schema::string();
        $ownerSchema->type = Schema::OBJECT;
        $ownerSchema->description = "Description with $dollar sign";
    }

Excepted output would look similar to this:

    public static function setUpProperties($properties, Schema $ownerSchema)
    {
        $properties->foo = Schema::string();
        $ownerSchema->type = Schema::OBJECT;
        $ownerSchema->description = "Description with \$dollar sign";
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions