Swagger 你不在 spring mvc 中的 Get 方法中发送参数?
Swagger you don't send parameters in Get method in spring mvc?
我有 spring 个有方法的 mvc 控制器。此方法获取一些参数。我配置 swagger 并使用 swagger 测试 request.When 我想尝试它不发送的请求参数。
@RequestMapping(value = "/listGrid", method = RequestMethod.GET)
public QueryResult<ActionViewModel> list(String searchFilter, String order,
int pageNumber, int pageSize) {
return actionService.getAllGridList(new SearchOption(searchFilter,
order, pageNumber, pageSize));
}
swagger为请求生成的curl是这个
curl -X GET --header 'Content-Type: application/json' --header 'Accept: */*' --header 'Authorization: Bearer 792a553e-b371-48a9-b031-12b634de4ce6' **-d '1'** 'http://localhost:8086/api/security/action/listGrid'
您尝试过在每个参数中添加 requestParam 注释吗?
@RequestMapping(value = "/listGrid", method = RequestMethod.GET)
public QueryResult<ActionViewModel> list(
@RequestParam String searchFilter,
@RequestParam String order,
@RequestParam int pageNumber,
@RequestParam int pageSize) {
// body
}
我有 spring 个有方法的 mvc 控制器。此方法获取一些参数。我配置 swagger 并使用 swagger 测试 request.When 我想尝试它不发送的请求参数。
@RequestMapping(value = "/listGrid", method = RequestMethod.GET)
public QueryResult<ActionViewModel> list(String searchFilter, String order,
int pageNumber, int pageSize) {
return actionService.getAllGridList(new SearchOption(searchFilter,
order, pageNumber, pageSize));
}
swagger为请求生成的curl是这个
curl -X GET --header 'Content-Type: application/json' --header 'Accept: */*' --header 'Authorization: Bearer 792a553e-b371-48a9-b031-12b634de4ce6' **-d '1'** 'http://localhost:8086/api/security/action/listGrid'
您尝试过在每个参数中添加 requestParam 注释吗?
@RequestMapping(value = "/listGrid", method = RequestMethod.GET)
public QueryResult<ActionViewModel> list(
@RequestParam String searchFilter,
@RequestParam String order,
@RequestParam int pageNumber,
@RequestParam int pageSize) {
// body
}