招摇的示例响应不尊重嵌套的 allOf

swagger example response not respecting nested allOf

当使用以下 swagger 时,生成的端点有一个示例响应与我认为 swagger(和模型)指示的内容不一致。

大摇大摆:

components:
  examples: {}
  headers: {}
  parameters: {}
  requestBodies: {}
  responses: {}
  schemas:
    SubSubData:
      type: object
      properties:
        subSubDataProp:
          type: string
    SubData:
      allOf:
        - $ref: '#/components/schemas/SubSubData'
        - type: object
          properties:
            subDataProp:
              type: string
    Data:
      allOf:
        - $ref: '#/components/schemas/SubData'
        - type: object
          properties:
            dataProp:
              type: string
    ExampleResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Data'
info:
  title: __PROJECT_NAME__
  version: 1.0.0
  description: |
    Add your Swagger description here.
  license:
    name: ISC
  contact:
    name: Me
openapi: 3.0.0
paths:
  /example:
    get:
      operationId: GetData
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExampleResponse'
      security: []

预期响应:

{
  "data": {
    "dataProp": "string",
    "subDataProp": "string",
    "subSubDataProp": "string"
  }
}

实际:

{
  "data": {
    "dataProp": "string"
  }
}

我错过了什么吗?或者这是 swagger 中的错误 ui/openapi

这是 Swagger 中的一个错误 UI:
https://github.com/swagger-api/swagger-ui/issues/5972

解决方法是将 paths 移到 components 之前。