check-jsonschema icon indicating copy to clipboard operation
check-jsonschema copied to clipboard

Cannot download schema using check-jsonschema

Open piotrwiniarczyk-silvair opened this issue 1 year ago • 3 comments

Hi

The following is not working check-jsonschema --schemafile 'https://www.bluetooth.com/specifications/specs/mesh-cdb-1-0-1-schema.json#' example.json Error: Unexpected Error building schema validator FailedDownloadError: got responses with status=403, retries exhausted

While the following is working (notice -L in curl): curl -L 'https://www.bluetooth.com/specifications/specs/mesh-cdb-1-0-1-schema.json#' | check-jsonschema --schemafile - example.json

The platform is Windows 11, running "GIT bash" terminal.

piotrwiniarczyk-silvair avatar Apr 22 '24 11:04 piotrwiniarczyk-silvair

Thanks for reporting this; I haven't had a chance to look into it in any serious way yet.

I'm not sure what's going on over at bluetooth.com, but they are serving up a 403 to GET requests made in python requests or urllib, but not to curl. This is almost definitely an issue over at the schema-provider's side, but I'm willing to poke at it a bit and see if I can do anything about it. Most likely, we need to find a point of contact for www.bluetooth.com to ask about this.

sirosen avatar Apr 29 '24 19:04 sirosen

I sent a request to their support form (which was awkward and not really an issue tracker) for now, but don't expect to hear much back.

I was able to confirm, in the course of writing up details for the upstream maintainers, that setting a dumb User-Agent like "" makes the error disappear. I'm not eager to bulk up the CLI with an option for this, but perhaps an env var to control the user agent would be appropriate. I'll have to chew on the best way to expose this to users if (as I expect) there's no response or a bad response upstream.

sirosen avatar Apr 29 '24 19:04 sirosen

Thanks for writing the bug report for the Bluetooth.com. I will also try to contact them.

The whole point with schema files is that they must be easily accessible via any http(s) client, even a very restricted one.

Per rfc723, section-5.5.3: A user agent SHOULD send a User-Agent field in each request unless specifically configured not to do so.

Since it is "SHOULD" (RFC2119 ) this header field is recommended but not mandatory.

3. SHOULD   This word, or the adjective "RECOMMENDED", mean that there
   may exist valid reasons in particular circumstances to ignore a
   particular item, but the full implications must be understood and
   carefully weighed before choosing a different course. 

piotrwiniarczyk-silvair avatar Apr 30 '24 07:04 piotrwiniarczyk-silvair