我是使用swaggerhub的新手。我需要定义一个API,并且请求必须看起来像这个json:
{
"acountNumber": "1234564545444854",
"warningTypes":[
{
"warningCode": 122,
"warningMessage": "string message"
}
]
}
此刻我有这个:
definitions:
WarningCodes:
type: object
required:
- accountNumber
- warningCodes
- messages
properties:
accountNumber:
type: string
example: 1234567890
warningTypes:
type: array
items:
type: object
properties:
warningCode:
type: integer
warningMessage:
type: string
不是以这种方式工作的。
答案 0 :(得分:0)
似乎需要这样的新实体
definitions:
WarningCodes:
type: object
required:
- accountNumber
- warningCodes
- messages
properties:
accountNumber:
type: string
example: '1234567890'
warningTypes:
type: array
items:
$ref: '#/definitions/WarningType'
WarningType:
type: object
properties:
warningCode:
type: integer
example: 122
warningMessage:
type: string
minLength: 0
maxLength: 256
example: test1,test