Closed kiwiroy closed 4 years ago
The gist makes my head hurt. There's just too much information there. Can you make https://github.com/mojolicious/json-validator/blob/master/t/load-file.t fail instead?
Closing this, since the issue seems to have gone stale.
yes, this is the same issue as jhthorsen/mojolicious-plugin-openapi#173 That is, the Mojolicious plugin is setting its own version
attribute which puts JSON::Validator into a mode where it thinks id
is a reference that it needs to resolve.
I attempted to fix this in https://github.com/mojolicious/json-validator/pull/152. The problem is that the '$schema'
key is not being parsed out of the document after it has been read, which is what tells us what spec version to use.
The easy solution is to instantiate the JSON::Validator object with the desired version attribute (or set it yourself later): my $jv = JSON::Validator->new->version(7)->schema(...)
-- it's important to do this before the schema is resolved, as it's not possible to go back and request a reparsing of the document with a different spec version's semantics (or erase what it thinks it learned about the document when it misparsed it the first time).
Steps to reproduce the behavior
where schema.yaml contains this snippet
See gist for more info.
Expected behavior
No error for the
file://
url. Usingdata://
and the same schema does not result in the error.Actual behavior
This appears to be solved by master...kiwiroy:file-schema-id
Using draft-7 also sidesteps the issue.