OpenAPI 3.0 - allOf inside oneOf

帅比萌擦擦* 提交于 2021-02-17 03:33:19

问题


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:


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


回答1:


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.



来源:https://stackoverflow.com/questions/52563638/openapi-3-0-allof-inside-oneof

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!