In my spring boot app, I have a DTO object with a nested list of DTO objects. class:
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "contact")
public class ContactDTO {
@ApiModelProperty(value = "id", example = "1", hidden = true)
private Long id;
@ApiModelProperty(value = "first name", example = "John")
private String firstName;
@ApiModelProperty(value = "last name", example = "Doe")
private String lastName;
@Builder.Default
@ApiModelProperty(value = "list of phone numbers", name = "phonenumbers")
List<PhoneNumberDTO> phoneNumberDTOList = new ArrayList<>();
}
the swagger example value for a post request:
{
"firstName": "John",
"lastName": "Doe",
"phoneNumberDTOList": [
{
"label": "Company",
"number": "put number here"
}
]
}
I thought the name = ...
property in @ApiModelProperty
overwrites the variable name phoneNumberDTOList
, but that doesn't work :(
I use springfox-swagger 2.9.2
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
What am I doing wrong?