I would like to add a description in Swagger documentation that some parameters in request body are optional.
Should I use @ApiParam
annotation for such description ? I tried to use @ApiModelProperty(notes = "")
but it didnt work.
@PostMapping(value = "/users/")
public ResponseEntity<Object> users(@RequestBody PostUserRequest postUserRequest) {}
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PostUserRequest {
@ApiParam(value = "This is optional parameter")
private String phone;
}
CodePudding user response:
You can use like this:
@ApiModelProperty(value = "This parameter is optional", required = false)
CodePudding user response: