-
Notifications
You must be signed in to change notification settings - Fork 280
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
Deferencing by $id with $ref in same schema doesn't seem to resolve #270
Comments
I've forked your repo with the examples in issue270 in https://github.com/mtokumaru/json-schema |
Hello @mtokumaru , the problem is that the validator by default assumes that your schema is a json schema draft-4 schema. In this older version of the schema specification the SchemaLoader loader = SchemaLoader.builder()
.schemaJson(yourSchemaJSON)
.draftV7Support()
.build();
Schema schema = loader.load().build(); Thanks for opening the issue, I will try to fit this bit into the documentation as a follow-up. Let me know if you can make it work. |
Thanks for the suggestion. However, I've tried this and it still fails for the same reason (using the above examples):
|
Take a second look at the exception, now you got a |
Yes, but why doesn't this example validate? Is |
Eg. |
Thanks, it still doesn't make any sense:
This implies that the inner object is not valid (
Conforms to:
from the schema above. So why does referencing |
Here's the JSON output of that exception:
|
Good question. It also works if you use |
The fix is released in version |
Hi there, we have used your library a few times but are currently experiencing an issue in
1.11.0
(actually I have tried older versions too).I was trying to use
$id
references as in the example here: https://json-schema.org/understanding-json-schema/structuring.html#using-id-with-refThe issue I have is with a schema that looks like
simple-schema.json
:And a sample JSON that looks like
simple-event.json
:Example test:
Validation fails seemingly because the
event
object definition cannot be found.If I use the absolute reference
"$ref": "#/defintions/event"
, it works fine.I've tried using the SchemaLoader with
resolutionScope
pointing to its own schema, but that also didn't work.There is a javascript validator that seems to be okay in this example: https://github.com/epoberezkin/ajv
I saw a similar issue that is closed #244 and seemed to be closed because the problem wasn't meant to work with external schemas.
Thanks in advance for your feedback!
The text was updated successfully, but these errors were encountered: