-
-
Notifications
You must be signed in to change notification settings - Fork 215
Test needed to differentiate between JSON Pointer or named schema in URI fragment #449
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
Comments
If I both remember right and follow reading your issue, yes, the former isn't a valid schema -- you're not saying there's a test in the suite that does so, right? You're saying we should add what, a metaschema test to ensure Happy to see that if so. |
Apologies for the confusion.
That's correct, at least based on my best understanding of all of the relevant specs that I have only just read today. Although someone more knowledgeable of the specs might want to verify that. |
There’s not yet a mechanism to test for invalid schemas, since some things aren’t expressible in a meta-schema. This is one example. Specifically, a meta-schema can’t really restrict the content of some things. (See the “$data” proposal stuff.) |
FWIW, that paragraph no longer exists in the latest published specification draft (https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.8.2.3). Strictly speaking, that's not an invalid schema. The value of the In order to (fail to) validate this against the metaschema, we'd need to be more specific about the expectations of But that's out of scope of the test suite. It would need to be done in the specification metaschema. |
I have been seeing this a lot recently:
However, according to the JSON pointer spec, JSON Pointers are supposed to start with
/
. According to the JSON Schema spec, if the fragment isn't a JSON Pointer, it is supposed to be treated as a named schema and therefore reference something with$id
set, not a path.The proper form for a JSON pointer would be:
(note the
/
after the#
).The first example would point to a named schema, however according to the spec, schema identifiers are prohibited from container the
/
character:Although it would seem like the last paragraph leaves a little room for interpretation.
The text was updated successfully, but these errors were encountered: