openapi

Reusing a subset of an enum in OpenAPI (Swagger)

孤人 提交于 2020-11-29 10:55:58
问题 I'm trying to achieve an OpenAPI definition where I define a shared, complete list of allowed values as an enum and then use subgroups of the values in different places to show which values are allowed in each case. Using the example from the enum spec on Swagger.io, if I have a definition like this: paths: /products: get: parameters: - in: query name: color required: true schema: $ref: '#/components/schemas/Color' responses: '200': description: OK components: schemas: Color: type: string