You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @YeJiaL, According to best practices, it is recommended to define all possible query parameters for a particular endpoint at the same level. To do this, you can use the @RequestParam annotation with the name attribute set to the name of the query parameter and required attribute set to false for each parameter.
By doing this, the Swagger UI will automatically detect the query parameters and generate the user interface accordingly.
@GetMapping(path = "items")
@ApiOperation(value = "Find items by name or description", response = ItemSearchResponse.class)
public ResponseEntity<?> searchItemsByName(@RequestParam("name", required=false) String name, @RequestParam("description", required=false) String description) {
// add checks for the case when query params were not sent in the api call
// you can use Objects.isNull(name)
}
@geetnsh2k1 when i use @GetMapping(params="key1=value1") on method ,and set enableUrlTemplating true, when i open the swagger UI ,i cannot test the urlMethod from the UI,becasuse the method has the additional param like xxx) .
jsut like picture show ,it has namespaceid)=""
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
enableUrlTemplating(true)
when set enableUrlTemplating true, the url is incorrect, unable to post the correct url
The text was updated successfully, but these errors were encountered: