-
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
Make schema object compatible with JSON Schema specification #1026
Comments
Great justification! I totally agree. |
Re: |
I don't really see the ability to define an OpenAPI definition that accepts an OpenAPI definition as a drive to support |
@webron I know @handrews and @philsturgeon have been on OpenAPI steering calls of late, sorry I haven't been able to attend due to travel. Has there been any further discussion or thoughts on this since 2017? |
Maybe this is the same as #1443 ? |
Correct @Relequestual, this would be taken care of by #1443. |
It's a shame that {
"type": "array",
"items": [
{ "type": "string" },
{ "type": "string" },
{ "type": "integer" }
]
} The closest thing is {
"type": "array",
"items": {
"anyOf": [
{ "type": "string" },
{ "type": "string" },
{ "type": "integer" }
]
},
"minItems": 3,
"maxItems": 3
} but ofc it's not the same. |
@handrews awesome! Thank you. |
Why not use an array of object?
I understand a tuple is not an object, because its members are unnamed. But I never saw a really good reason why it's a problem to name the members. |
@tedepstein you are right but the spec i'm working on is for an existing API not a new one, changing it it's a breaking change. |
@lpinca, thank you for the explanation. I feel better now. :-) |
Label Looks like version 3 of OpenAPI specification still doesn't support tuple syntax for arrays:
Is it correct? |
I was hoping that alternative schema would be the savior here, but the current approach is not what I hoped it would be: OAI/sig-moonwalk#121 Instead #1977 is a new effort at closing the gap on OpenAPI v3.1 and JSON Schema. |
This was fixed in #1977 so we can close this. |
That's is related to #333
Given that all the major differences were removed in version 3, what is the reason to have remaining differences?
Additional fields in schema are not a problem, but it still beats me why the restrictions are needed - they create nothing but inconvenience. The argument that certain functionality of tools can't be supported for the full JSON schema spec (see #333 (comment) by @fehguy) is a very week one to not support full JSON schema in API spec.
Instead, OpenAPI can say that tools can choose to support full or restricted JSON-schema and make it clear in their documentation.
I understand that it means that the code in some language may not be possible to generate due to the restrictions of those languages. But it should be the problem constrained to the users of that particular language rather than to all users (using more dynamic/loosely typed languages). If I were to need to generate c++ code from OpenAPI spec, the generator would impose these restrictions and I would simplify the API definition file.
Having full JSON-schema spec allowed outweighs the benefit that ALL tools can always work with the schema - I believe it should be left to the developer's discretion to decide whether to use full/restricted schema rather than having "restricted" imposed by OpenAPI as the only possible option. This "nanny state" approach is very frustrating when using this spec.
It would also allow to simplify this spec by simply referencing JSON schema spec instead of redefining it here.
The text was updated successfully, but these errors were encountered: