-
Notifications
You must be signed in to change notification settings - Fork 279
Add type: "null" downcasting when in oneOf and anyOf for OpenAPI v3
#2645
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
Add type: "null" downcasting when in oneOf and anyOf for OpenAPI v3
#2645
Conversation
|
@microsoft-github-policy-service agree |
|
@baywet I've drafted this PR. Let me know what you think. Some parts are a little bit rough imho, for example the update to Edit: I just went ahead and implemented it. I know that I take a risk that this won't be merged or requires significant changes, then I will just see it as an exercise 🙃 |
baywet
left a comment
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.
Thanks for the contribution!
Co-authored-by: Vincent Biret <vincentbiret@hotmail.com>
…and use JsonNode.DeepEquals in tests Co-authored-by: desjoerd <2460430+desjoerd@users.noreply.github.com>
Co-authored-by: desjoerd <2460430+desjoerd@users.noreply.github.com>
Co-authored-by: desjoerd <2460430+desjoerd@users.noreply.github.com>
Address PR microsoft#2645 review comments: improve type checking logic and use JsonNode.DeepEquals
|
@baywet I've addressed your comments (with copilot so I could go to the movie Zootopia 2 in the meantime 😎, AI let's programming really happen from your phone 😜). Let me know if I need to change something. |
|
@baywet I've removed that whole code block around HasMultipleTypes, this part is already covered when writing the type property. I noticed that when you gave me the link to the location where HasMultipleTypes is used. |
baywet
left a comment
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.
Thanks for the contribution!
Add
type: "null"downcasting when in oneOf and anyOf for OpenAPI v3Description
This PR adds downcasting of oneOf and anyOf for openapi v3.
When writing OpenAPI v3 it will remove schemas from oneOf and anyOf with
{ "type": "null" }and apply it to the parent asnullable: true. It also tries to find a common overlappingtypewhich will also be applied to the parent schema asnullable: trueis only doing something whentypeis specified.It's between a bug-fix and a feature as the current situation downcasts
{ "type": "null" }to{ "nullable": true }which according to some clarifications of the spec doesn't do anything and tools expect thenullable: trueon the parent schema.Type of Change
Related Issue(s)
Changes Made
type: nullfor OpenAPI v3.Testing
Checklist
Versions applicability