Giter Club home page Giter Club logo

Comments (5)

dankar avatar dankar commented on August 19, 2024 1

I would think that it's against the purpose of using these kinds of tools. I want to be able to reuse objects as much as possible, instead of implementing them over and over. These examples were simple, but in reality I have numerous big objects that are used tens of times in different messages. The only caveat in this case is that I want to have the message fully defined, and not allow any additional properties in any part of it.

But of course, it's up to you, I just thought I should report it :)

from glee.

KhudaDad414 avatar KhudaDad414 commented on August 19, 2024

@dankar, I think I spotted the issue in your schema. The problem is with using allOf and setting additionalProperties: false at the same time. Here's why:

  • allOf is strict: With allOf, your message has to match both schemas.
  • No extra properties allowed: That additionalProperties: false setting makes things tricky because it means absolutely no other properties can exist.

Your schemas are fighting each other in a paradox.

Change additionalProperties to true in one of your schemas. That'll make things a bit more flexible and should fix the error.

Let me know if that works! 😊

from glee.

dankar avatar dankar commented on August 19, 2024

@KhudaDad414 Thank you for your answer. I'm then a bit unsure of how to specify what I want: I do want the message to contain all of those objects, but absolutely nothing else.

Is it then not possible to specify that?

from glee.

KhudaDad414 avatar KhudaDad414 commented on August 19, 2024

I guess the best bet would be to combine your schemas into one schema. something like:

{
  "additionalProperties": false,
  "title": "setParamResult",
  "type": "object",
  "required": [
    "id",
    "valueString"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "valueString": {
      "type": "string"
    }
  }
}

if this is not a choice then I am not exactly sure if it's possible with allOf.
I am closing the issue for now.

from glee.

KhudaDad414 avatar KhudaDad414 commented on August 19, 2024

@dankar, you are correct. this is a limitation. but since we are using JSON Schema there is nothing we can do to address this issue. you can open an issue in the JSON Schema and if they change things things are going to work here automatically.
All I want to say is there there is nothing that we can do here.

from glee.

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.