Skip to content

Commit 6917aad

Browse files
authored
fix: use apikey name in header instead of securityDefinition spec id (#17022)
1 parent 2b9ee8c commit 6917aad

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • modules/openapi-generator/src/main/resources/powershell

modules/openapi-generator/src/main/resources/powershell/api.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ function {{{vendorExtensions.x-powershell-method-name}}} {
178178
{{#authMethods}}
179179
{{#isApiKey}}
180180
{{#isKeyInHeader}}
181-
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{name}}}"]) {
182-
$LocalVarHeaderParameters['{{{name}}}'] = $Configuration["ApiKey"]["{{{name}}}"]
183-
Write-Verbose ("Using API key '{{{name}}}' in the header for authentication in {0}" -f $MyInvocation.MyCommand)
181+
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{keyParamName}}}"]) {
182+
$LocalVarHeaderParameters['{{{keyParamName}}}'] = $Configuration["ApiKey"]["{{{keyParamName}}}"]
183+
Write-Verbose ("Using API key '{{{keyParamName}}}' in the header for authentication in {0}" -f $MyInvocation.MyCommand)
184184
}
185185
{{/isKeyInHeader}}
186186
{{#isKeyInQuery}}
187-
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{name}}}"]) {
188-
$LocalVarQueryParameters['{{{name}}}'] = $Configuration["ApiKey"]["{{{name}}}"]
189-
Write-Verbose ("Using API key `{{{name}}}` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand)
187+
if ($Configuration["ApiKey"] -and $Configuration["ApiKey"]["{{{keyParamName}}}"]) {
188+
$LocalVarQueryParameters['{{{keyParamName}}}'] = $Configuration["ApiKey"]["{{{keyParamName}}}"]
189+
Write-Verbose ("Using API key `{{{keyParamName}}}` in the URL query for authentication in {0}" -f $MyInvocation.MyCommand)
190190
}
191191
{{/isKeyInQuery}}
192192
{{#isKeyInCookie}}

0 commit comments

Comments
 (0)