-
Notifications
You must be signed in to change notification settings - Fork 693
Closed as not planned
Closed as not planned
Copy link
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Description
I have OpenAPI generated controllers that use Optional
for non-required parameters. This results in API like this where, e.g., Pageable
is wrapped in the Optional
:
@RequestMapping(
method = RequestMethod.GET,
value = "/discovery/agent",
produces = {"application/json"})
default ResponseEntity<DiscoveryAgentPageRestDto> _discoveryAgentGet(
@Parameter(name = "pageable", description = "Defines page number, page size, sort property and order", schema = @Schema(description = "")) @Valid Optional<Pageable> pageable,
@Parameter(name = "q", description = "Search query", schema = @Schema(description = "")) @Valid @RequestParam(value = "q", required = false) Optional<String> q)
throws Exception {
return discoveryAgentGet(pageable, q);
}
However, the stock Spring Framework PageableHandlerMethodArgumentResolver
does not handle this. PageableHandlerMethodArgumentResolver
should resolve Optional<Pageable>
arguments
Cross reference: spring-projects/spring-framework#17589 (comment)
Metadata
Metadata
Assignees
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply