I have a POJO model that contains lots of fields. When we generate OpenApi Swagger docs for external users, we only want to expose a subset of the fields. Is there a way to do that? We don't want to change the POJO to add @ApiModelProperty
for each field.
Asked
Active
Viewed 122 times
1

jlp
- 1,656
- 6
- 33
- 48
-
I don't know an easier way then to write it yourself, after `javac` is done, like [this may be](https://stackoverflow.com/questions/1635108/adding-java-annotations-at-runtime), but it will not be easy – Eugene May 05 '21 at 18:40
-
have you considered facading the pojo's with boundary classes, exposing only the fields which are used in the request? – Joost Papendorp May 05 '21 at 20:14