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

"$id" is (slightly) non-compliant (hidden by errors in JSON Schema Test Suite) #69

Closed
handrews opened this issue Mar 9, 2023 · 0 comments · Fixed by #80
Closed

"$id" is (slightly) non-compliant (hidden by errors in JSON Schema Test Suite) #69

handrews opened this issue Mar 9, 2023 · 0 comments · Fixed by #80

Comments

@handrews
Copy link
Contributor

handrews commented Mar 9, 2023

In 2019-09 and 2020-12, the constraints on the value of "$id" are:

  • SHOULD be normalized
  • MUST NOT have a non-empty fragment
  • SHOULD NOT have an empty fragment

Therefore a compliant implementation is expected to support "$id" with non-normalized and/or empty-fragment-having URI-references, as documented by several tests in the test suite:

The only reason jschon passes these tests is that they put the $id in question in the data rather than in the schema, while making the schema a reference to the standard meta-schema. Which means that all these tests do is test that the data is valid against the meta-schema, which of course it is....

...except in draft-next where fragments are no longer allowed, which is enforced by the meta-schema, causing the $id-with-fragment tests to fail on draft-next (no matter what jschon is or isn't doing). This is how I figured out what was happening.


@marksparkza , I definitely get wanting to forbid these cases (goodness knows I've wanted to for many years), but as a matter of compliance they need to be allowed. There could be opt-in enforcement of additional rules for this (and perhaps #64 / #66 regarding non-plain-name-fragment $refs), as something of a built-in linter.

However, as can be seen on the implementations page (look for This implementation documents), non-compliant default behavior will be flagged.

@handrews handrews changed the title "$id" is non-compliant due to errors in JSON Schema Test Suite "$id" is non-compliant (hidden by errors in JSON Schema Test Suite) Mar 9, 2023
@handrews handrews changed the title "$id" is non-compliant (hidden by errors in JSON Schema Test Suite) "$id" is (slightly) non-compliant (hidden by errors in JSON Schema Test Suite) Mar 9, 2023
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

Successfully merging a pull request may close this issue.

1 participant