-
-
Notifications
You must be signed in to change notification settings - Fork 215
Add tests for referencing / identifying schemas via URN URIs #179
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
I'm not sure whether I follow whether that issue means to be a bug report or not. Do you know what full schema we'd be talking about? What would it mean to $ref an urn URI without specifying what that urn refers to? |
If you have pre-loaded schemas that declared is with |
In my totally subjective opinion, implementations should not only attempt to retrieve a reference over the network if the URI is a URL, and then unless there's some other clear reason to do otherwise should use the protocol associated with the scheme. Even then technically it's just an identifier according to the spec. |
Ah, OK, I figured that's what that meant, but the Python library (well, mine) does support that, so maybe the author of that just didn't find it. It might be nice to test that sort of stuff here, but right now the test suite has no way of communicating that out of band info (of "here's some other stuff, coordinate being able to look them up"). Might need a bit of extending to our test vocabulary.. |
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
Ach sorry. I didn't realise I handn't also included a link to the schema. The urn in full is used as the id for fields. I forgot about the fact that the value of $ref need to start with a hash # to be relative to the current document. I confess I didn't look into this in great detail; it's the first I've heard of urn's. From my limited research, it looks like they are really depricated, and URLs in full should be used, but there you go.
That's fair enough, and it sounds like it would be a complex ask. Maybe we could add a section to the repos readme to clarify what the test suite DOES NOT test in terms of expected compliance. I think that somoene implementing JSON Schema and inetegrating the test suite should probably be able to work that out, but if it's simple to compile, then it sounds like it could be useful! (Not suggesting it be an exhaustive list.) |
How does that play into this case? URNs are URIs so a reference to them would not start with a # whether they are in the same file or not. |
This comment has been minimized.
This comment has been minimized.
It'd probably be useful to have a few different tests just to show the diversity of possible names, for example have at least one specified as a UUID URN, and another as an ni: URI. As for how tests are written, I'm a fan of alternative syntaxes for JSON, which is pretty horrible as far as human-writable data formats go (No comments, no trailing commas, or newlines in strings? Really?)... But since JSON Schema is only defined over JSON it'd be kind of awkward for the official test suite to use anything else (it feels like a conflict of interest sort of thing). |
Right you are. So the solution would be that pre loading the JSON shchema, they should define a urn registry of some kind? (I've never seen urn's before coming across this repo. Whole thing seems sort of odd to me) |
@Relequestual I think the only thing that needs validating here is that if an implementation has seen a schema with an Basically, it doesn't matter what kind of URI or URI Reference is used in an ID, an implementation should be able to remember and use it. On the other hand, if a These seem verifiable in the test suite. We don't need to cover all schemes, but basically there are two general URI syntaxes, as seen in Section 3 of RFC 3986:
Since an authority starts with '//' these are easy to distinguish, and we should test that both work since many URL-oriented libraries fail to properly handle URN-ish URIs. |
See https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01#section-8.2.1 (which specifies that $id is any URI from RFC 3986, which URNs are an example of). Earlier drafts (6 and 7) didn't fully disallow $ids with fragments (they left the behavior undefined, and their metaschemas didn't guard against them), so we leave off the f-component test in these drafts. Closes: #179
See https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-01#section-8.2.1 (which specifies that $id is any URI from RFC 3986, which URNs are an example of). Earlier drafts (6 and 7) didn't fully disallow $ids with fragments (they left the behavior undefined, and their metaschemas didn't guard against them), so we leave off the f-component test in these drafts. Closes: #179
Came across the folliwng issue...
phenopackets/phenopacket-format#55
Is this something we should test for?
Something like "ids defined should be checked before trying to resolve externally"?
The text was updated successfully, but these errors were encountered: