【发布时间】:2020-05-14 15:16:35
【问题描述】:
我正在尝试根据 OpenAPI 3 规范为 API 编写一些文档。我想要实现的是每次enum 更改时加载不同的schema。
比如我有这个参数。
parameters:
- description: The operation code (OC)
required: true
schema:
$ref: '#/components/schemas/OperationCode'
name: oc
in: query
具有此架构:
components:
schemas:
OperationCode:
type: string
enum:
- Operation1
- Operation2
现在,在下面,我希望根据之前的枚举选择动态更改另一个参数:
- description: Required parameters for selected operation code
required: true
schema:
$ref: ????
name: parameters
in: "body"
假设我想在这两种模式之间进行选择:
components:
schemas:
Operation1:
properties:
id1:
type: integer
Operation2:
properties:
id2:
type: integer
关于如何实现这一目标的任何想法?提前谢谢你。
【问题讨论】: