Add type: "null" downcasting when in oneOf and anyOf for OpenAPI v3#2645
Add type: "null" downcasting when in oneOf and anyOf for OpenAPI v3#2645baywet merged 13 commits intomicrosoft:support/v2from
type: "null" downcasting when in oneOf and anyOf for OpenAPI v3#2645Conversation
|
@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 🙃 |
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. |
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