我有响应结构:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
allOf:
- { $ref: ../../components/schemas/Product.yaml }
example:
active: false
Run Code Online (Sandbox Code Playgroud)
还有 Product.yaml 之一:
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
Run Code Online (Sandbox Code Playgroud)
所以我想覆盖活动示例,当我这样做时:
data:
allOf:
- { $ref: ../../components/schemas/Product.yaml }
example:
active: false
Run Code Online (Sandbox Code Playgroud)
在“响应示例”下的 redoc ui 中,我看到唯一的活动属性。
我的问题是如何在不覆盖每个产品属性的情况下覆盖仅活动属性的示例?
无法覆盖示例中的单个属性值。您需要提供整个示例:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: ../../components/schemas/Product.yaml
example:
data:
id: 1
name: fresh baguette
active: false
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5951 次 |
| 最近记录: |