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

Loading schema in version 6/7 which refers schema with previous version (4) #164

Closed
MarcBouteiller opened this issue Apr 10, 2018 · 2 comments

Comments

@MarcBouteiller
Copy link

MarcBouteiller commented Apr 10, 2018

When a root schema is loaded with version 6 (or higher), with a nested reference with a version 4, the loader keeps the V6 spec version, and an exception is thrown because of the backwards incompatible changes of "exclusiveMinimum" and "exclusiveMaximum".

Example:

{
  "$schema": "http://json-schema.org/draft-06/schema#",
    "properties": {
      "parameter": {
        "type": "array",
          "items": {
             "$ref": "http://swagger.io/v2/schema.json#/definitions/parameter"
           }
        }
    }
}

The target of $ref is under version 4. #165

@erosb
Copy link
Contributor

erosb commented Apr 10, 2018

Right, that is an issue to be addressed. Thanks for opening an issue.
I would hugely appreciate if you could open a PR with a failing test for it, as it is described in the contribution guidelines.

Thanks

MarcBouteiller pushed a commit to MarcBouteiller/json-schema that referenced this issue Apr 10, 2018
erosb added a commit that referenced this issue May 11, 2018
 * changing `"$schema"` lookup in `SchemaLoader` to fall back to `rootSchemaJson` if no `"$schema"` is present in `schemaJson`
 * also changing `SchemaLoader` to handle not just Maps but JsonObjects too when looking for `"$schema"`
 * minor code cleanup in `ReferenceLookup#extend()`
 * changed issue test to use the localhost instead of swagger.io
erosb added a commit that referenced this issue May 18, 2018
@erosb
Copy link
Contributor

erosb commented Jun 7, 2018

The fix is available in the latest release: 1.9.0

@erosb erosb closed this as completed Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants