redoc icon indicating copy to clipboard operation
redoc copied to clipboard

allOf refer to multiple oneOf, only one oneOf is kept

Open aleung opened this issue 3 years ago • 1 comments

Describe the bug When the items under the allOf are $ref to oneOf, only one of the oneOf is left in the merge result.

Expected behavior In below example, the HTML output should includes two selectors, each one corresponding to an oneOf. And the properties list should have two properties.

Minimal reproducible OpenAPI snippet(if possible)

components:
  schemas:
    IdOrName:
        oneOf:
          - title: By ID
            properties:
              id:
                type: string
          - title: By Name
            properties:
              name:
                type: string
    AgeOrBirth:
        oneOf:
          - title: By Age
            properties:
              age:
                type: number
          - title: By Birth
            properties:
              birth:
                type: number
    DataA:
      allOf:
        - $ref: "#/components/schemas/IdOrName"
        - $ref: "#/components/schemas/AgeOrBirth"

Screenshots Selection_042

aleung avatar Jul 01 '22 11:07 aleung

Hi @aleung, thanks for reporting the issue.

Note: For some reason when we use refs, behavior is not correct.

expected behavior should be: Screenshot 2022-07-21 at 19 24 25

AlexVarchuk avatar Jul 21 '22 16:07 AlexVarchuk