【发布时间】:2021-08-11 20:42:43
【问题描述】:
给定一个包含两部分的路径模板,例如:
paths:
/blah/{fooPart}-stuff-{barPart}:
parameters:
- in: path
name: fooPart
description: foo part of this matrix ID
required: true
schema:
type: string
- in: path
name: barPart
description: bar part of this matrix ID
required: true
schema:
type: string
我想提供一个示例列表。由于 fooPart 和 barPart 是相关的,我希望每个示例都有相关的数据元素。我想把它放在组件中
examples:
Happy:
summary: Happy path
value:
fooPart: red
barPart: up
Sad:
summary: Sad path
value:
fooPart: up
barPart: red
当我将引用作为示例列表添加到每个参数时,就像这样
- in: path
name: fooPart
description: foo part of this matrix ID
required: true
schema:
type: string
examples:
happy:
$ref: "#/components/example/Happy"
sad:
$ref: "#/components/example/Sad"
渲染的显示......足够了吗?错误的?没有帮助?这些示例不相关,指定为值的数组显示在每个参数as seen here 的框中。我知道,这是我告诉它做的。有没有办法将所有示例捆绑在一起?还是我唯一的选择是我将提供的答案?呃。
【问题讨论】: