【发布时间】:2015-11-22 04:34:26
【问题描述】:
我想使用definitions 中定义的枚举作为查询字符串中参数定义的一部分。
我在我的 Swagger 2.0 规范文件的 definitions 部分中定义 Swagger 枚举。
OperationType:
type: string
enum:
- registration
- renewal
我可以在其他定义中创建对它的引用:
Operation:
type: object
properties:
name:
type: string
type:
$ref: '#/definitions/OperationType'
当参数为in: body时我可以使用schema标签来引用它,但当它是in: query时则不行
- name: operation
in: body
description: description
schema:
$ref: '#/definitions/OperationType'
我尝试删除 schema: 并在 enum: 中进行引用,但无法正常工作。
【问题讨论】:
标签: swagger swagger-2.0