4

There is an entity with a field

      cises:
        type: array
        description: An array of brands. The length must match the value of the quantity field, or the array must be empty
        items:
          type: string

Code java

  @SerializedName("cises")
  private List<String> cises = null;

How to use swagger codegen to set an empty list by default, instead of null

Helen
  • 87,344
  • 17
  • 243
  • 314

1 Answers1

6

There is an open issue with the swagger codegen ignoring the default: [] for array. See [JAVA] Empty array not getting picked as default for the defined model in Open API AKA Swagger generated code for more information.
It's suggested to use required as a workaround for now.

Marcus
  • 318
  • 5
  • 10