Skip to content

How URI resolution will work if $id keyword is an empty string? Or if multiple schemas have the same canonical URI? #259

Answered by handrews
flaksp asked this question in Q&A
Discussion options

You must be logged in to vote

"" is a relative URI-reference with a path component consisting of an empty string. Setting "$id": "" like this is technically an error in accordance with §9.1.2:

A schema MAY (and likely will) have multiple URIs, but there is no way for a URI to identify more than one schema. When multiple schemas try to identify as the same URI, validators SHOULD raise an error condition.

because resolving "" against the base URI of ""https://example.com/Foo" just produces "https://example.com/Foo" again, meaning that both of these "$id"s attempt to assign the same URI to two different schemas.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@handrews
Comment options

Answer selected by flaksp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants