我的API包含字段result
,其类型为string
,但只能包含以下值之一-success
或error
。如何在Swagger
中定义它?
不用说
ServerResponse: #{result: ..., additional-info: ...}
type: object
properties:
result:
type: string #generic type, could be any string
additional-info:
type: string
required:
- result
- additional-info
我想说
ServerResponse: #{result: ..., additional-info: ...}
type: object
properties:
result:
type: 'success' or 'error'#<-- something like this with specific list of possible value
additional-info:
type: string
required:
- result
- additional-info