From 39218f38379e19cab580a08c62f5a55209f04776 Mon Sep 17 00:00:00 2001 From: Daniel Zheng Date: Mon, 20 Nov 2023 11:53:49 -0800 Subject: [PATCH] fix(request): Properly declare optional request parameters Optional is not the right way to declare that a particular request parameter is not required. There was a similar issue in the corresponding clouddriver endpoint that was fixed by https://github.com/spinnaker/clouddriver/pull/6067 --- .../spinnaker/gate/controllers/CredentialsController.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy index 1b7093b79b..be5e1f6be1 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/controllers/CredentialsController.groovy @@ -97,11 +97,11 @@ class CredentialsController { @ApiParam(value = 'Value of the "@type" key for accounts to search for.', example = 'kubernetes') @PathVariable String accountType, @ApiParam('Maximum number of entries to return in results. Used for pagination.') - @RequestParam OptionalInt limit, + @RequestParam(required = false, defaultValue = "100") Integer limit, @ApiParam('Account name to start account definition listing from. Used for pagination.') - @RequestParam Optional startingAccountName + @RequestParam(required = false) String startingAccountName ) { - clouddriverService.getAccountDefinitionsByType(accountType, limit.isPresent() ? limit.getAsInt() : null, startingAccountName.orElse(null)) + clouddriverService.getAccountDefinitionsByType(accountType, limit, startingAccountName) } @PostMapping