File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed
modules/openapi-generator/src/main/resources/ruby-client Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,9 @@ require '{{{gemName}}}'
72
72
# Configure Bearer authorization{ {#bearerFormat} } ({ {{.} }}){ {/bearerFormat} }: { {{name} }}
73
73
config.access_token = 'YOUR_BEARER_TOKEN'{ {/isBasicBearer} }{ {/isBasic} }{ {#isApiKey} }
74
74
# Configure API key authorization: { {{name} }}
75
- config.api_key['{ {{keyParamName } }}'] = 'YOUR API KEY'
75
+ config.api_key['{ {{name } }}'] = 'YOUR API KEY'
76
76
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
77
- #config.api_key_prefix['{ {{keyParamName } }}'] = 'Bearer'{ {/isApiKey} }{ {#isOAuth} }
77
+ # config.api_key_prefix['{ {{name } }}'] = 'Bearer'{ {/isApiKey} }{ {#isOAuth} }
78
78
# Configure OAuth2 access token for authorization: { {{name} }}
79
79
config.access_token = 'YOUR ACCESS TOKEN'{ {/isOAuth} }
80
80
{ {/authMethods} }end
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ module {{moduleName}}
182
182
case auth_setting[:in]
183
183
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
184
184
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
185
- else fail ArgumentError, 'Authentication token must be in `query` of `header`'
185
+ else fail ArgumentError, 'Authentication token must be in `query` or `header`'
186
186
end
187
187
end
188
188
end
Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ require '{{{gemName}}}'
37
37
# Configure Bearer authorization{ {#bearerFormat} } ({ {{.} }}){ {/bearerFormat} }: { {{name} }}
38
38
config.access_token = 'YOUR_BEARER_TOKEN'{ {/isBasicBearer} }{ {/isBasic} }{ {#isApiKey} }
39
39
# Configure API key authorization: { {{name} }}
40
- config.api_key['{ {{keyParamName } }}'] = 'YOUR API KEY'
40
+ config.api_key['{ {{name } }}'] = 'YOUR API KEY'
41
41
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
42
- # config.api_key_prefix['{ {{keyParamName } }}'] = 'Bearer'{ {/isApiKey} }{ {#isOAuth} }
42
+ # config.api_key_prefix['{ {{name } }}'] = 'Bearer'{ {/isApiKey} }{ {#isOAuth} }
43
43
# Configure OAuth2 access token for authorization: { {{name} }}
44
44
config.access_token = 'YOUR ACCESS TOKEN'{ {/isOAuth} }
45
45
{ {/authMethods} }end
Original file line number Diff line number Diff line change @@ -169,11 +169,13 @@ module {{moduleName}}
169
169
170
170
# Gets API key (with prefix if set).
171
171
# @param [String] param_name the parameter name of API key auth
172
- def api_key_with_prefix(param_name)
172
+ def api_key_with_prefix(param_name, param_alias = nil)
173
+ key = @api_key[param_name]
174
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
173
175
if @api_key_prefix[param_name]
174
- "#{ @api_key_prefix[param_name]} #{ @api_key[param_name] } "
176
+ "#{ @api_key_prefix[param_name]} #{ key } "
175
177
else
176
- @api_key[param_name]
178
+ key
177
179
end
178
180
end
179
181
@@ -192,7 +194,7 @@ module {{moduleName}}
192
194
type: ' api_key' ,
193
195
in: {{#isKeyInHeader} }'header'{ {/isKeyInHeader} }{ {#isKeyInQuery} }'query'{ {/isKeyInQuery} },
194
196
key: '{ {keyParamName} }',
195
- value: api_key_with_prefix('{ {keyParamName } }')
197
+ value: api_key_with_prefix('{ {name } }'{ {#vendorExtensions.x-auth-id-alias } }, ' { {. } }' { {/vendorExtensions.x-auth-id-alias } } )
196
198
},
197
199
{ {/isApiKey} }
198
200
{ {#isBasic} }
You can’t perform that action at this time.
0 commit comments