Search code examples
swaggeropenapiswagger-editor

OpenAPI 3.0 - allOf inside oneOf


The following YAML:

openapi: 3.0.0
info:
  title: test
  version: 1.0.0
paths:
  /test:
    get:
      summary: test
      responses:
        '200':
          description: Test
          content:
            application/json:
              schema:
                oneOf:
                  - allOf:
                    - type: object
                      properties:
                        firstA:
                          type: string
                    - type: object
                      properties:
                        firstB:
                          type: string
                  - allOf:
                    - type: object
                      properties:
                        secondA:
                          type: string
                    - type: object
                      properties:
                        secondB:
                          type: string

Does not render at all in the swagger editor.

In ReDoc it also fails to render properly:

enter image description here


If nesting multiple allOf instances directly inside of oneOf is invalid, how could I achieve the same result with a valid spec?


Solution

  • ReDoc author here. It is a ReDoc bug. Your spec is valid.

    It has been already fixed and will be available in 2.0.0-alpha.40.