Skip to content
Advertisement

Hiding unimportant getter methods from swagger UI in Java [duplicate]

I have two fields in my class startDate and endDate of LocalDateTime. Internally, these need to be returned as Optional<ZonedDateTime>, while in the query they are provided as LocalDateTimes.

JavaScript

Swagger (Springfox v2.9.2) now shows the needed fields but also endDateWithTimezone.present and startDateWithTimezone.present, which are of course both not needed as parameters:

enter image description here

I have been trying for some time now to find ways to hide these from my swagger documentation. How can I do this?

Advertisement

Answer

The solution was quite simple in the end.

You have to use the annotation @ApiModelProperty(hidden = true) directly on the getter you want to hide.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement