-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could array items contain an array of schemas? #1869
Comments
@handrews Thank you for pointing me to one of the possible future solutions. It does look interesting, with support for other types of schema definitions. It is good to keep things decoupled. In the meantime I'll just work around it. |
@handrews, @analogue Hi I've got the same problem. Actually ordering of my objects is not specific but the kind of objects are. Did you solve it? If so, can you please share that? For example i need different named objects to contain different properties, e.g.: [
{ "n" : "fanspeed", "maxSpeed" : 999, "stepping" : 10, "ot" : "Fan" },
{ "n" : "aqi", "good" : 44, "poor" : 124, "hazardous" : 150, "ot" : "PM" }
] Where the ot = Fan and PM ar completely different schema objects. Cheers, |
@mariotoffia PR #1977 updates the forthcoming OpenAPI Specification 3.1 to use JSON Schema draft |
This was fixed in #1977 so we can close this. |
I'm having difficulty understanding why in a requestBody one cannot specify the elements of an array explicitly. One can only have a general schema that applies to all items.
As it states in the latest OpenApi Spec:
But in json schema it states:
My particular API REALLY needs to have request bodies that contain arrays with specifically ordered and typed elements, but with the current definition this is not allowed. I'm having a hard time understanding why the specification should disallow the definition of any particular JSON structure.
My schema definition currently breaks all the tools, so I've worked around it by defining my schemas as empty like so:
and then I provide the details of how it should really be structured in the examples section.
So, as the title says, I'd like to know why it was chosen to not allow this. I'd also like to know if anyone would be open to the idea of getting rid of the "and not an array" requirement? I know this likely has a variety of implications, but let's talk about them 😀.
The text was updated successfully, but these errors were encountered: