Summary
ExJsonSchema.Schema.resolve/1 rejects schemas whose $schema URI uses the https:// scheme, raising UnsupportedSchemaVersionError. Per the JSON Schema specification, $schema is an identifier, not a literal URL, and the official meta-schema is served over HTTPS at https://json-schema.org/draft-07/schema.
Reproduction
schema = %{
"$schema" => "https://json-schema.org/draft-07/schema#",
"type" => "object",
"properties" => %{"name" => %{"type" => "string"}}
}
ExJsonSchema.Schema.resolve(schema)
#=> ** (ExJsonSchema.Schema.UnsupportedSchemaVersionError) Unsupported schema version, only draft 4, 6, and 7 are supported.
The same schema with http:// resolves cleanly.
Proposed fix
In lib/ex_json_schema/schema.ex, schema_module/2 and remote_schema/1 pattern-match on the http:// prefix only. A head clause that rewrites https://json-schema.org/... to http://json-schema.org/... before dispatch fixes both with no behavioural change for any other input. PR open at #98.
Summary
ExJsonSchema.Schema.resolve/1rejects schemas whose$schemaURI uses thehttps://scheme, raisingUnsupportedSchemaVersionError. Per the JSON Schema specification,$schemais an identifier, not a literal URL, and the official meta-schema is served over HTTPS at https://json-schema.org/draft-07/schema.Reproduction
The same schema with
http://resolves cleanly.Proposed fix
In
lib/ex_json_schema/schema.ex,schema_module/2andremote_schema/1pattern-match on thehttp://prefix only. A head clause that rewriteshttps://json-schema.org/...tohttp://json-schema.org/...before dispatch fixes both with no behavioural change for any other input. PR open at #98.