Issue
I've got a search endpoint in my REST service. I'm using Spring Boot, so I've got a @RestController setup with a method that returns search results based on a search query. This is the method definition:
@ApiOperation(value = "Get global search results")
@RequestMapping(method = GET, produces = {"application/json"})
public SearchResults get(SearchQuery query) {
...
}
I was hoping that SwaggerUI would show the SearchQuery's fields as separate query params in the ui. It doesn't; it just shows a generic "query" param. If I annotate query with @RequestBody the user can add a json payload to the body, but this is a GET request - I want the user to only use query params.
Any ideas?
Solution
Annotate SearchQuery
with @ModelAttribute
and it should work as expected.
Answered By - Dilip Krishnan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.