Accept https:// JSON Schema URIs#98
Open
elias-ba wants to merge 1 commit intojonasschmidt:masterfrom
Open
Conversation
The JSON Schema spec calls $schema an identifier, not a literal URL, and json-schema.org now serves both http:// and https:// forms. Tools commonly emit https://, but `schema_module/2` and `remote_schema/1` only matched the canonical http:// prefix and raised UnsupportedSchemaVersionError on any https:// input. Normalize https://json-schema.org/... to http://json-schema.org/... at the top of both functions. No behavioural change for any other input. Closes jonasschmidt#97
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #97.
schema_module/2andremote_schema/1only matched the canonicalhttp://prefix, so any schema usinghttps://json-schema.org/...(which json-schema.org's own site serves) was rejected withUnsupportedSchemaVersionError. Per the spec,$schemais an identifier, not a literal URL.A head clause on each function rewrites
https://json-schema.org/...tohttp://json-schema.org/...before dispatch. No behavioural change for any other input.A new test in
test/ex_json_schema/schema_test.exsexercises both URI forms for drafts 6 and 7. The three failures already present inschema_test.exspredate this change (the bundled fixture server returns 500 for those cases onmaster).