Content-Length: 291961 | pFad | http://github.com/oapi-codegen/oapi-codegen/pull/1904

6C fix: #1905 handle `oneOf` in nested `allOf` schemas by matgr1 · Pull Request #1904 · oapi-codegen/oapi-codegen · GitHub
Skip to content

fix: #1905 handle oneOf in nested allOf schemas #1904

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matgr1
Copy link

@matgr1 matgr1 commented Feb 14, 2025

the main purpose of this PR is to fix the situation where oneOf gets lost in deeply nested allOf schemas, for example:

{
  "allOf": [
    {
      "allOf": [
        {
          "oneOf": [
            { "properties": { "a_foo_one_of_0": { "type": "string" } } },
            { "properties": { "a_foo_one_of_1": { "type": "string" } } }
          ]
        }
      ]
    },
    { "properties": { "a_foo": { "type": "string" } } }
  ]
}

see added comments in merge_schemas.go for explanation

other fixes/improvements:

  • includes anyOf as well as oneOf during schema merge
  • improves duplicate typename log message (includes path and detailed diff)
  • removes unused parameter in mergeOpenapiSchemas

@matgr1 matgr1 requested a review from a team as a code owner February 14, 2025 18:13
@matgr1 matgr1 marked this pull request as draft February 14, 2025 18:13
@matgr1 matgr1 force-pushed the fix-one-of-nesting branch from 18f41f2 to 040c7aa Compare February 14, 2025 18:52
@matgr1 matgr1 force-pushed the fix-one-of-nesting branch from 040c7aa to eb82ae9 Compare February 14, 2025 19:02
@matgr1 matgr1 changed the title fix: fully flatten allOf; handle oneOf/anyOf more correctly fix: #1905 fully flatten allOf; handle oneOf/anyOf more correctly Feb 14, 2025
@matgr1 matgr1 changed the title fix: #1905 fully flatten allOf; handle oneOf/anyOf more correctly fix: #1905 handle oneOf in nested allOf schemas Feb 14, 2025
@matgr1 matgr1 marked this pull request as ready for review February 14, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/oapi-codegen/oapi-codegen/pull/1904

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy