小编Shr*_*uti的帖子

对象属性 swagger 的多个示例

我正在尝试为对象属性添加多个示例。我使用的 Swagger-Ui 和 Editor 版本是

'{"swaggerEditor":"3.6.31/g10642b3c-dirty","swaggerUi":{"version":"3.23.0","gitRevision":"g23d7260f","gitDirty":true,"buildTimestamp":"Sat, 29 Jun 2019 19:42:59 GMT","machine":"jenins-swagger-oss"}}'
Run Code Online (Sandbox Code Playgroud)

基于OpenAPI doc,此版本的 swagger UI 和编辑器支持多个示例,但我仍然看到此错误:

Structural error at components.schemas.MainObject.allOf.3.properties.partitionProperty
should NOT have additional properties
additionalProperty: examples
Jump to line 3016
Run Code Online (Sandbox Code Playgroud)

这就是我在属性中添加示例的方式:

    MainObject:
      allOf:
      - $ref: '#/components/schemas/MainObjectLite'
      - type: object
        description: foobar.
        readOnly: true
        required:
          - fooRequired
        properties:
         fooRequired:
            type: string
            description: system only field used for table data indexing
         partitionProperty:
            type: string
            description: foobar
            examples:
              sampleExample:
                value: 2016-03-04T03:00:00
                summary: sample partition
Run Code Online (Sandbox Code Playgroud)

swagger swagger-ui swagger-editor openapi

4
推荐指数
1
解决办法
8558
查看次数

标签 统计

openapi ×1

swagger ×1

swagger-editor ×1

swagger-ui ×1