Code Monkey home page Code Monkey logo

Comments (4)

maldimirov avatar maldimirov commented on August 26, 2024 1

Yes, I think the schema is not valid. And I don't know why jsonschema and ajv would behave like that. I would speculate that their code does not stop execution on the first occurrence of a validation keyword, but goes on and so executes several validations on the same data because there are several validation keywords in the schema. But even that would not explain this behavior, since from the anyOf spec (sec. 6.7.2):

Each item of the array MUST be a valid JSON Schema

And in your example that is not true.



* This is my understanding of the spec and I may be wrong.

** If I understand correctly your case, you should be able to just use minProperties.

from enjoi.

tlivings avatar tlivings commented on August 26, 2024

Thanks, looking into this.

from enjoi.

maldimirov avatar maldimirov commented on August 26, 2024

anyOf and type are two different validation keywords. I don't think you can use two validation keywords alongside in the same schema. At least I don't see that allowed in the spec.
The other option is for anyOf to be a validation keyword for the object type, but that is also not the case sec. 6.5.

I don't think what you described is the expected behavior.

from enjoi.

rmehner avatar rmehner commented on August 26, 2024

@maldimirov Thanks for looking into this. If I understand you right, you're saying that my schema is not valid per spec?

If so, both jsonschema and ajv behave not according to spec, as I've mentioned above. But it would explain why enjoi can't deal with it.

from enjoi.

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.