Skip to content

Incorrect extends handling #4

@ddosia

Description

@ddosia

According to http://tools.ietf.org/html/draft-zyp-json-schema-03#page-14 extends field could be or scheme (aka JSON object) or array of schemas (JSON array).

this example will illustrate error:
api.json:

{
    "type" : "object",
    "extends" : [
        {"$ref" : "rq.json"},
        {
            "properties" : {
                "id" : {
                    "type" : "integer",
                    "required" : true
                }
            }
        }
    ]
}

rq.json:

{
    "abstract" : "true",
    "type" : "object",
    "properties" : {
        "type" : {
            "type" : "string",
            "maxLength" : "10",
            "minLength" : "2"
        }
    }
}

Result:

$ jerg -s . -t -
    escript: exception error: no match of right hand side value false
      in function  jerg:get_schema/2 (src/jerg.erl, line 158)
      in call from jerg:collect_properties/2 (src/jerg.erl, line 334)
      in call from jerg:output_properties/3 (src/jerg.erl, line 283)
      in call from jerg:output_object_record/4 (src/jerg.erl, line 262)
      in call from jerg:output_records/3 (src/jerg.erl, line 245)
      in call from jerg:run/1 (src/jerg.erl, line 88)
      in call from jerg:main/1 (src/jerg.erl, line 34)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions