3 回答
TA贡献1808条经验 获得超4个赞
如果您使用通用映射的唯一顾虑只是 Swagger 是否准确,为什么不直接将注释添加到终结点呢?这将允许您指定 Swagger 输出中需要哪些参数:@ApiImplicitParams
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "name", type = "String", required = true, paramType = "query"),
@ApiImplicitParam(name = "id", type = "String", required = true, paramType = "query")
})
TA贡献2011条经验 获得超2个赞
尝试
@RequestMapping
public String books(@RequestParam Map<String, String> requestParams, Other params)
{
//Your code here
}
TA贡献1829条经验 获得超7个赞
你可以做一个类,例如
@Data
public class Paramss {
@NotNull
private String a;
private String b;
}
然后
@GetMapping
public Object params( @Valid @ModelAttribute Paramss params ) {
return params;
}
添加回答
举报