-
Notifications
You must be signed in to change notification settings - Fork 61
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
spec: replace nullable value with null type #436
Conversation
1e51085
to
b269b80
Compare
I am wondering. Do we need this:
or would following also work:
|
I think |
Changes AnalysisCommit SHA: 7a668a9 API ChangesSummary
ReportThe full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/10007058434/artifacts/1719115605 API Coverage
|
The quoted |
type: string | ||
- type: | ||
- 'null' | ||
- string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this actually mean?
oneOf:
- type: number
- type:
- 'null'
- string
Is it not the same as
type:
- oneOf:
- number
- string
- 'null'
or even
type: [number, string, 'null']
If "nullable string" is a thing, maybe we should declare it as NullableString
and use a ref
?
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If my research is correct then both following definitions are valid.
oneOf:
- type: 'null'
- type: number
- type: string
type:
- 'null'
- number
- string
According to https://blog.stoplight.io/difference-between-open-v2-v3-v31
With OpenAPI 3.1, the specification now supports type as an array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I change all of those to the second definition with type as an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's necessary, but collapsing the nested structure probably is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: ['null', 'number', 'string']
Is the best option IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
without quotes is not valid and will fail the validation test.
https://github.com/Jakob3xD/opensearch-api-specification/actions/runs/10003423255/job/27650310114
I'll do the suggested type array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using the type array we need to set allowUnionTypes for Ajv but I am not sure where I can configure it.
Yes, otherwise it get interpreted by yaml. |
So, can we introduce a |
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
Signed-off-by: Jakob Hahn <[email protected]>
Description
Issues Resolved
Closes #366
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.