-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mixed formats in referenced schema definitions #232
Comments
Hey @nantipov , thanks for reporting. It should indeed work. Let me dig into it today. We might indeed be missing something on the logic to read JSON / YAML. |
Fixes: #232 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@nantipov I'm struggling to reproduce. Are you using
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$ref": "http://example.com/schema.yaml"
}
"foo" And then this works fine: jsonschema validate schema.json --resolve schema.yaml instance.json |
Ah, it's the HTTP resolver indeed. I have a test and a fix. I'll release a new version in a bit |
Fixes: #232 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Hello @jviotti thanks for a quick follow up on this and checking all the things around. Well, yes, it was in combination of But it seems you have already found the culprit in the HTTP resolver. Thanks a lot. Looking forward for helping with testing the updated version. |
Fixes: #232 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Fixes: #232 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Fixes: #232 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Fixes: #232 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@nantipov Awesome! I'm releasing v6.0.1 in a bit. I'll let you know so you can give it a shot and confirm the fix |
Done @nantipov ! See https://github.com/sourcemeta/jsonschema/releases/tag/v6.0.1. Also uploaded to NPM and Homebrew. Please re-open if you still hit the issue! |
Hi @jviotti , thanks a lot for such a quick fix. Looks great. |
Any time! And if you have any suggestions for the tool, please let me know! |
Would it possible to add support of a mixed formats in schemas definitions?
Or is there already existing capability?
For example, a schema defined in
json
points via$ref
to a schema defined inyaml
.For now in such a use-case I get
error: Failed to parse the JSON document at line 1 and column 1
.example schema
dependant schema http://example.com/schemas/name.yaml
Thank you.
Remark
This might seen as a short followup on the topic of
yaml
andOpenAPI
(#80)The text was updated successfully, but these errors were encountered: