Giter Club home page Giter Club logo

Comments (4)

sirosen avatar sirosen commented on May 27, 2024

Thanks for the info; this lets me see the same error.
I also confirmed that this is an issue specific to the schemastore prometheus schema. I was able to create a scenario analogous to yours in which a ref to a known-valid schemastore schema (the github workflows one) works correctly.

I'm 99% certain at this point that it's just the fact that the prometheus schema has a bad $id field.
I'll use this scenario to work on improving the error reporting in check-jsonschema and then file an upstream issue.

from check-jsonschema.

sirosen avatar sirosen commented on May 27, 2024

I've just pushed a commit to main which makes the error in this case clearer, as it traverses and prints some of the most relevant info from chained exceptions on ref resolution errors.

Example output:

$ check-jsonschema --schemafile schema.json values.yaml
Failure resolving $ref within schema

RefResolutionError: HTTP Error 404: Not Found
  in "/home/sirosen/projects/check-jsonschema/src/check_jsonschema/checker.py", line 99
  >>> errors = self._build_error_map(validator, instances)

  caused by

  HTTPError: HTTP Error 404: Not Found
    in "/home/sirosen/projects/check-jsonschema/.venv/lib/python3.8/site-packages/jsonschema/validators.py", line 777
    >>> document = self.resolve_remote(url)

    caused by

    KeyError: 'https://json.schemastore.org/prometheus.rules'
      in "/home/sirosen/projects/check-jsonschema/.venv/lib/python3.8/site-packages/jsonschema/validators.py", line 774
      >>> document = self.store[url]

I also confirmed that the sample content passes the prometheus schema if it is corrected to have an accurate $id.

I'm retitling the issue, as there is no relevant bug in check-jsonschema or the underlying jsonschema library.

from check-jsonschema.

sirosen avatar sirosen commented on May 27, 2024

I've opened an issue upstream, SchemaStore/schemastore#1928

With that and improved error handling in place within check-jsonschema, there's nothing more to be done here. I'm closing; tracking can continue on the upstream issue.

from check-jsonschema.

dudicoco avatar dudicoco commented on May 27, 2024

Thanks @sirosen!

from check-jsonschema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.