Swagger 如何覆盖openapi中的示例?
我的回应结构如下:Swagger 如何覆盖openapi中的示例?,swagger,openapi,Swagger,Openapi,我的回应结构如下: responses: '200': description: OK content: application/json: schema: type: object properties: data: allOf: - { $ref: ../../components/schemas/Product.yaml }
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
allOf:
- { $ref: ../../components/schemas/Product.yaml }
example:
active: false
和产品。yaml one:
type: object
description: Product
properties:
id:
description: ID
type: integer
example: 1
name:
description: Name
type: string
example: 'fresh baguette'
active:
description: Is active
type: boolean
example: true
所以我想覆盖活动示例,当我这样做时:
data:
allOf:
- { $ref: ../../components/schemas/Product.yaml }
example:
active: false
在“Response samples”下的redoc ui中,我看到了唯一的活动属性
我的问题是如何在不覆盖每个产品属性的情况下覆盖仅活动属性的示例?无法覆盖示例中的单个属性值。您需要提供整个示例:
响应:
'200':
描述:好的
内容:
应用程序/json:
模式:
类型:对象
特性:
数据:
$ref:../components/schemas/Product.yaml
例子:
数据:
身份证号码:1
名称:新鲜法式面包
活动:错误
我的openapi版本是3.0.2