Giter Club home page Giter Club logo

Comments (4)

jfinkhaeuser avatar jfinkhaeuser commented on May 30, 2024 1

Thanks!

Actually, that's not precisely bug - unfortunately, I might say. I've come across this before, and you may come across this when using AWS in particular.

The thing is, OpenAPI specs are a little vague in some edge cases, and this is one of them.

OpenAPI specs generally provide examples as YAML files, but crucially include the mandate that specs must validate given an appropriate JSON schema. Which means the YAML you can use must be the subset of YAML that also works in JSON. And JSON does not allow any keys that are not strings (YAML allows any object, though the notation for that is horrendous).

So for a strict validation, an integer 200 must raise an error.

I have wondered about a lenient mode to prance that would stringify keys before trying to validate, but I'm not sure that might not have unintended side effects. Would that be helpful, or are you happy to change to string "200" instead?

from prance.

jfinkhaeuser avatar jfinkhaeuser commented on May 30, 2024

Mind you, the location of that error might be weird. I'm going to look into it one way or another :)

from prance.

jfinkhaeuser avatar jfinkhaeuser commented on May 30, 2024

No, the error location is exactly what I suspected: the JSON validator requires string keys and finds non-string keys.

I've added a non-strict mode as outlined that stringifies keys. I hope that's in your interest :)

from prance.

jfinkhaeuser avatar jfinkhaeuser commented on May 30, 2024

Fixed in v0.6.0

from prance.

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.