Zach
Zach

Reputation: 113

springfox-swagger2 @ModelAttribute suppression

I am using springfox-swagger2 and want to suppress the @ModelAttribute from generating documentation. Does anyone know an easy way I can set a property in my configuration class so it skips over these fields?

Thanks!

Upvotes: 0

Views: 1027

Answers (1)

Dilip Krishnan
Dilip Krishnan

Reputation: 5487

Currently @ModelAttributes cannot be suppressed. However specific classes can be. For e.g. if you have a controller method

@RequestMapping(...)
public void someMethod(@ModelAttribute SomeModel)

you could ignore the type SomeModel and it will not be rendered or shown in the swagger api description. You can do this by adding to the ignoredParameterTypes in your Docket

Upvotes: 1

Related Questions