Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 springfox-swagger2 并希望抑制 @ModelAttribute 生成文档。有谁知道我可以在配置类中设置属性以便跳过这些字段的简单方法?
谢谢!
目前@ModelAttributes无法压制。但是可以是特定的类。例如,如果你有一个控制器方法
@ModelAttributes
@RequestMapping(...) public void someMethod(@ModelAttribute SomeModel)
您可以忽略类型SomeModel,它不会在 swagger api 描述中呈现或显示。您可以通过ignoredParameterTypes在您的Docket
SomeModel
ignoredParameterTypes
Docket