以下是从python执行中生成的YAML
requestBody:
content:
application/json:
schema:
properties:
element_ids:
items:
type: string
type: array
element_type:
items:
enum:
- NC
- CELL
type: string
type: array
expires_in:
format: int32
type: integer
group_id:
type: string
required:
- element_ids
- element_type
- expires_in
- group_id
我以列表的形式提供了枚举值。
在下面显示的swagger(3.0.0)中我只能看到NC
答案 0 :(得分:1)
您的规格正确。 “示例值”根据您在OpenAPI文件中指定的信息显示一个示例请求。完整的枚举列在模式标签上:
如果要在JSON示例中显示"element_type": ["NC", "CELL"]
,请将相应的example
添加到element_type
属性定义中:
element_type:
items:
enum:
- NC
- CELL
type: string
type: array
example: [NC, CELL] # <----------