-
In my Kotlin code I have a data class with a not-nullable List field (see below). Eventhough the field is not included in the JSON if the List is empty, Swagger marks the field as required (red asterisk).
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
/cc @MikeEdgar (swagger-ui), @evanchooly (kotlin), @geoand (kotlin), @phillip-kruger (swagger-ui) |
Beta Was this translation helpful? Give feedback.
-
@DerJochen , the scanner is making it required based on the presence of @get:Schema(required = false) |
Beta Was this translation helpful? Give feedback.
@DerJochen , the scanner is making it required based on the presence of
@NotNull
on the field and the getter generated by Kotlin. When setting therequired
attribute, it is taking both the field and the generated method into account, so adding an annotation to apply to the getter should fix this in your case.