jdiegodcp / ramlfications

Python parser for RAML
https://ramlfications.readthedocs.org
Apache License 2.0
234 stars 50 forks source link

Parse `$ref`s in JSON #4

Closed econchick closed 8 years ago

econchick commented 9 years ago

One can construct JSON pointers using $refs, e.g.

{
  "definitions": {
    "address": {
      "type": "object",
      "properties": {
        "street_address": { "type": "string" },
        "city":           { "type": "string" },
        "state":          { "type": "string" }
      },
      "required": ["street_address", "city", "state"]
    }
  }
}
{ "$ref": "#/definitions/address" }

Right now the package doesn't resolve those $refs, and will actually probably need a separate library (maybe jsonref).

jenner commented 9 years ago

jsonschema has a resolver class which can be used to resolve refs relative to schema, i.e. something like { "$ref": "#/definitions/$Thingy/.." } would resolve to an included Thingy schema items

econchick commented 9 years ago

@jenner yesssss thanks for the tip!

benhamill commented 9 years ago

Would you accept a pull request adding this functionality?

econchick commented 9 years ago

@benhamill definitely

jenner commented 9 years ago

@benhamill thanks in advance :)

econchick commented 8 years ago

Being worked on via #19

econchick commented 8 years ago

addressed in #40