Giter Club home page Giter Club logo

Comments (3)

davishmcclurg avatar davishmcclurg commented on September 28, 2024

That's tricky. There was a similar issue with symbol keys causing issues as well. It might be worth validating that all the schema keys are strings. Another option would be allowing schemas to validate themselves against their meta-schema. I was hoping to not have to do that because of how it would impact performance, but I should test how much overhead it actually causes.

Can I ask how you're using the library? You should be able to introduce something like deep_stringify_keys before passing the schema hash in to get things working how you expect.

from json_schemer.

jfeltesse-mdsol avatar jfeltesse-mdsol commented on September 28, 2024

Can I ask how you're using the library?

We have a tool that lints our OpenAPI spec files and the very first thing it does is to validate the OpenAPI against the schema.
Right now we're using json-schema and it doesn't seem to care about such integer keys, for right or wrong.

I'd rather not having to do any processing to the schema we pass to validate and leave that to the library. Errors are expected and I guess it wouldn't be out of place for json_schemer to raise on such cases. The only thing then is it should raise proper errors so we can rescue them properly.
If not raising is desirable then internally it should rescue everything and return an error without blowing up. I don't know if it's by design but for instance if I pass nil or an empty string right now it doesn't raise.

from json_schemer.

jfeltesse-mdsol avatar jfeltesse-mdsol commented on September 28, 2024

Allow me to close this issue, we figured that we're talking about json schema and by definition the keys are string so this is something we need to handle when processing our input YAML files so they behave the same as JSON files (which is also a valid OpenAPI format).
Thanks!

from json_schemer.

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.