Reputation: 391
I'm using Spring boot with Swagger 2(using springfox to wrapper).
I have a big entity that a lot of fields is filled automatic at server side and I have a service to store them. Instead of swagger show all the attributes of this entity like this I want to show a custom json to store this entity, if possible I would like to show the attributes to send like this
My controller:
@RequestMapping(value = "/cadastrar", method = RequestMethod.POST, produces= "Application/JSON")
public ResponseEntity<?> cadastrarUsuario(@RequestBody @Valid AcessoUsuario usuario, BindingResult result) {
.. }
Please someone could help me? I'm a little lost how to do this with Swagger.
Upvotes: 0
Views: 495
Reputation: 6824
If you don't like all the auto-detected, public fields in your model, you have two choices.
Define an interface that shows what you are interested in, and map that to the operation that is either consuming or producing that entity.
Create a custom model processor which handles types as you like.
Upvotes: 1