【问题标题】:Swagger 2.0 default null for List in models模型中 List 的 Swagger 2.0 默认 null
【发布时间】:2018-08-01 18:14:05
【问题描述】:

我正在尝试构建一个模型对象,其中包含一个“字符串列表”键值对。有没有办法将列表默认为 null 而不是空列表?

目前这是模型的设置方式:

Filter:
type: "object"
properties:
  and:
    type: "array"
    items:
      $ref: "#/FilterField"
  or:
    type: "array"
    items:
      $ref: "#/FilterField"

or 字段为空时,它只会生成一个空列表or: [],有没有办法生成or: null 而不是or: []

【问题讨论】:

  • 您正在生成哪种语言/框架? (codegen 的-l 选项)
  • 请应用降价来标记内联代码 sn-ps 而不是将它们放在引号之间。

标签: swagger swagger-2.0 swagger-codegen openapi openapi-generator


【解决方案1】:

根据这篇帖子https://github.com/swagger-api/swagger-codegen/issues/5240 它已在 2.2.2 中修复

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-08
    • 1970-01-01
    • 2011-06-04
    • 1970-01-01
    • 1970-01-01
    • 2018-10-11
    • 2022-08-06
    • 1970-01-01
    相关资源
    最近更新 更多