Closed kaihendry closed 11 months ago
Thanks for reporting! This is a bug/limitation in terms of how YAML is supported. Also, I think the message can and should be clarified in this case. I'm happy to take suggestions on that if you have ideas after reading my explanation.
The downloader component doesn't just do a download -- it also does a validation step. The idea is to catch a malformed download and retry it.
Looking into the details a bit, the validation callback, although pluggable, is always set to JSON parsing. (This is the bug! :bug: ) So what happens is that we try to download the file and parse it as JSON. That fails, and then we retry in a small loop.
The validation behavior can catch and avoid some nasty cases, so I'd like to keep it. But it needs to be aware that content could be YAML in addition to JSON.
Slightly more broadly, validation needs to expand to support all of the formats check-jsonschema
supports (TOML, JSON5), and then try parsing the way it does with a local file. Suffix-less files will still get the JSON behavior -- a bias towards JSON being appropriate for JSON Schema tooling -- but anything .yaml
or .yml
needs to be supported.
idk if you want or not to support YAML, else I'll look to another tool like https://github.com/neilpa/yajsv and attempt to write a pre-commit hook myself 🤷
I'll never discourage looking at other tools! check-jsonschema
is here to help, but if it's not getting your job done, something different might be better for you in the short (or long) term. But YAML is supposed to be supported, so I'll be fixing this as soon as I can dedicate some time to work on the issue.
When YAML support was added, it was intentionally kept very narrow, but it's now sensible to expand to include remote schemas and $ref
s.
Ok, be cool if you figure it out. Thank you Stephen!
In order to check files in config/*.yaml I am using:
But it fails with:
I don't understand why it fails with status 200 success?