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

Claims: Schema has invalid URI for bundle spec ref #241

Closed
vdice opened this issue Aug 7, 2019 · 3 comments
Closed

Claims: Schema has invalid URI for bundle spec ref #241

vdice opened this issue Aug 7, 2019 · 3 comments

Comments

@vdice
Copy link
Member

vdice commented Aug 7, 2019

The Claim schema has a $ref field associated with its bundle property pointing to a URI that doesn't exist. (http://cnab.io/v1/bundle.schema.json)

We should ensure this URI exists and/or update it accordingly.

I hit this in an attempt to validate a generated claim programmatically; the library used attempted to fetch the ref'd schema but errored out as it was not found.

@vdice
Copy link
Member Author

vdice commented Aug 7, 2019

Actually, we might make this issue more general to ensure the base bundle schema's $id (http://cnab.io/v1/bundle.schema.json) represents a valid URI that can be fetched over the network.

(This happens to be the only schema referenced by another, currently... but perhaps we'd want to ensure all schemas in the schema dir have valid URIs as $ids?)

@itowlson
Copy link

itowlson commented Aug 9, 2019

Minor note: JSON Schema reference URIs are not expected to be traversable; they are only identifiers, not locators.

"Even though the value of a $ref is a URI, it is not a network locator, only an identifier. This means that the schema doesn’t need to be accessible at that URI, but it may be. It is basically up to the validator implementation how external schema URIs will be handled, but one should not assume the validator will fetch network resources indicated in $ref values."

https://json-schema.org/understanding-json-schema/structuring.html#reuse

So it's up to validators to gather all the schemas they're going to need using out-of-band knowledge, and use the $id to link them together.

From a human point of view, though, having the schema available at its $id URI sure helps the author of the validator to find the referenced schemas they need!

@vdice
Copy link
Member Author

vdice commented Aug 20, 2019

Tracking the work in cnabio/cnab.io#15; closing this ticket.

@vdice vdice closed this as completed Aug 20, 2019
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