我的定义如下:
ShippingMethod:
required:
- id
- code
- description
- type
type: object
properties:
id:
title: Id
type: string
maxLength: 36
minLength: 1
distributor:
title: Distributor
type: string
maxLength: 255
minLength: 1
code:
title: Code
type: string
maxLength: 255
minLength: 1
description:
title: Description
type: string
minLength: 1
type:
title: Type
type: string
maxLength: 255
minLength: 1
在swagger.io的编辑器中,它向我显示了GET调用(列表)所需的响应:
[
{
"id": "string",
"distributor": "string",
"code": "string",
"description": "string",
"type": "string"
}
]
但是在Apiary中使用相同内容时,它会转换为以下响应:
[
{
"id": "exercitation quis",
"code": "est",
"description": "laborum veniam",
"type": "cupidatat proident sed"
},
{
"id": "officia sint consequat Ut",
"code": "sit mollit",
"description": "consectetur qui aute esse ut",
"type": "nisi Excepteur velit dolor"
}
]
分配器将是响应中的一个字段,但未在Apiary呈现的响应中显示。在定义中将其设为必需时,它将购物,但这不是我想要的。
如何确保这些可选字段确实出现在响应中?