@ModelAttribute表演像身体一样招摇
我使用org.springdoc:springdoc-openapi-ui:1.6.9
我有控制器:
@GetMapping
public ResponseEntity<String> getApplications(@ModelAttribute ApplicationFilter applicationFilter){return null;}
并且有类参数:
@Getter
@Setter
@NoArgsConstructor
public class ApplicationFilter {
@Parameter(name = "ids", required = true)
private List<Long> ids;
}
我需要模型绘制以显示为
但是是真实的表演,形式为 body
如果添加@schema(name =”这是字段”)
字段 - 结果
请告诉我。我需要做什么,以使我的@modelattribute显示为参数字段?
I use org.springdoc:springdoc-openapi-ui:1.6.9
I have controller:
@GetMapping
public ResponseEntity<String> getApplications(@ModelAttribute ApplicationFilter applicationFilter){return null;}
And have class param:
@Getter
@Setter
@NoArgsConstructor
public class ApplicationFilter {
@Parameter(name = "ids", required = true)
private List<Long> ids;
}
I need ModelAttribute to be displayed as parameter fields in Swagger.
But is real show in the form of body
If add @Schema(name = "This is field")
over field - result
Please tell me. What do I need to do so that my @ModelAttribute is displayed as parameter fields?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找到了适合我的解决方案:
添加注释@parameterObject
Found a solution that suits me:
add annotation @ParameterObject
请注意,您还使用
@parameterObject
对类注释,无需在Controller的参数中指定该注释。Note that you also annotate your class with
@ParameterObject
, there is no need to to specify that annotation in controller's arguments.