Skip to content

Accept https:// JSON Schema URIs#98

Merged
jonasschmidt merged 1 commit intojonasschmidt:masterfrom
elias-ba:accept-https-schema-uri
May 6, 2026
Merged

Accept https:// JSON Schema URIs#98
jonasschmidt merged 1 commit intojonasschmidt:masterfrom
elias-ba:accept-https-schema-uri

Conversation

@elias-ba
Copy link
Copy Markdown
Contributor

@elias-ba elias-ba commented May 1, 2026

Closes #97.

schema_module/2 and remote_schema/1 only matched the canonical http:// prefix, so any schema using https://json-schema.org/... (which json-schema.org's own site serves) was rejected with UnsupportedSchemaVersionError. Per the spec, $schema is an identifier, not a literal URL.

A head clause on each function rewrites https://json-schema.org/... to http://json-schema.org/... before dispatch. No behavioural change for any other input.

A new test in test/ex_json_schema/schema_test.exs exercises both URI forms for drafts 6 and 7. The three failures already present in schema_test.exs predate this change (the bundled fixture server returns 500 for those cases on master).

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
Copy link
Copy Markdown
Owner

@jonasschmidt jonasschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR, this looks straight-forward enough. I think it's better than matching on the URL via regex or other more sophisticated methods. I will merge and release this today 👍 🚀

@coveralls
Copy link
Copy Markdown

coveralls commented May 6, 2026

Coverage Status

coverage: 91.806% (-0.2%) from 91.963% — elias-ba:accept-https-schema-uri into jonasschmidt:master

@jonasschmidt jonasschmidt merged commit e6a4168 into jonasschmidt:master May 6, 2026
3 of 4 checks passed
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

Successfully merging this pull request may close these issues.

Schemas with https:// $schema URIs raise UnsupportedSchemaVersionError

3 participants