Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Ignore $ref siblings & abort on infinite-loop references #437

Merged
merged 5 commits into from
Jun 23, 2017

Commits on Jun 21, 2017

  1. Add tests for $ref enforcement

    erayd committed Jun 21, 2017
    Configuration menu
    Copy the full SHA
    46266cb View commit details
    Browse the repository at this point in the history
  2. Overriding schema properties from $ref is not allowed

    From the spec [1]:
        An object schema with a "$ref" property MUST be interpreted as a
        "$ref" reference.  The value of the "$ref" property MUST be a URI
        Reference.  Resolved against the current URI base, it identifies the
        URI of a schema to use.  All other properties in a "$ref" object MUST
        be ignored.
    
    [1] https://tools.ietf.org/html/draft-wright-json-schema-01#section-8
    erayd committed Jun 21, 2017
    Configuration menu
    Copy the full SHA
    276e546 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    48b2884 View commit details
    Browse the repository at this point in the history
  4. Return dereferenced schema directly and check for infinite-loops

    Schemas containing $ref MUST ignore all other properties, so just return
    the reference target directly.
    
    Because some circular references may result in an infinite loop, keep
    track of the objects that have been dereferenced during the current call
    to SchemaStorage and abort if the same object is encountered more than
    once.
    erayd committed Jun 21, 2017
    Configuration menu
    Copy the full SHA
    54abf73 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1f877bf View commit details
    Browse the repository at this point in the history