From 6917aad7601638f689c01f45f0cd4bece1d9ea2d Mon Sep 17 00:00:00 2001 From: Elon Mallin Date: Sun, 12 Nov 2023 16:18:12 +0100 Subject: [PATCH] fix: use apikey name in header instead of securityDefinition spec id (#17022) --- .../src/main/resources/powershell/api.mustache | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/powershell/api.mustache b/modules/openapi-generator/src/main/resources/powershell/api.mustache index e94ffd28275..79d632682cf 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api.mustache @@ -178,15 +178,15 @@ function {{{vendorExtensions.x-powershell-method-name}}} { {{#authMethods}} {{#isApiKey}} {{#isKeyInHeader}} - if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{name}}}"]) { - $LocalVarHeaderParameters['{{{name}}}'] = $Configuration["ApiKey"]["{{{name}}}"] - Write-Verbose ("Using API key '{{{name}}}' in the header for authentication in {0}" -f $MyInvocation.MyCommand) + if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{keyParamName}}}"]) { + $LocalVarHeaderParameters['{{{keyParamName}}}'] = $Configuration["ApiKey"]["{{{keyParamName}}}"] + Write-Verbose ("Using API key '{{{keyParamName}}}' in the header for authentication in {0}" -f $MyInvocation.MyCommand) } {{/isKeyInHeader}} {{#isKeyInQuery}} - if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{name}}}"]) { - $LocalVarQueryParameters['{{{name}}}'] = $Configuration["ApiKey"]["{{{name}}}"] - Write-Verbose ("Using API key `{{{name}}}` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand) + if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{keyParamName}}}"]) { + $LocalVarQueryParameters['{{{keyParamName}}}'] = $Configuration["ApiKey"]["{{{keyParamName}}}"] + Write-Verbose ("Using API key `{{{keyParamName}}}` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand) } {{/isKeyInQuery}} {{#isKeyInCookie}}