如果请求未收到,SWAGGER 2将键添加到对象

时间:2019-04-30 14:08:06

标签: python-3.x swagger swagger-ui swagger-2.0

如果在请求中未收到密钥,SWAGGER模式是否可以向对象添加密钥?图解示例:

 topobject:
    type: object
    properties:
      attra:
        type: ["string", "null"]
        default: null
        example: "0231"
      attrb:
        type: string
        example: 12abc3123abc123
    required:
      - attrb

我想知道是否收到像

这样的请求

body: {topobject: {attrb:"asdasdad"}}

swagger可以将其转换为:

body: {topobject: {attrb:"asdasdad", attra: null}}

即添加具有默认值的密钥

谢谢!

0 个答案:

没有答案