File tree 6 files changed +33
-12
lines changed
modules/openapi-generator/src/main/resources/ruby-client
samples/openapi3/client/petstore/ruby 6 files changed +33
-12
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,12 @@ Please follow the [installation](#installation) procedure and then run the follo
65
65
require '{ {{gemName} }}'
66
66
{ {#apiInfo} }{ {#apis} }{ {#-first} }{ {#operations} }{ {#operation} }{ {#-first} }{ {#hasAuthMethods} }
67
67
# Setup authorization
68
- { {{moduleName} }}.configure do |config|{ {#authMethods} }{ {#isBasic} }
68
+ { {{moduleName} }}.configure do |config|{ {#authMethods} }{ {#isBasic} }{ {^isBasicBearer } }
69
69
# Configure HTTP basic authorization: { {{name} }}
70
- config.username = 'YOUR USERNAME'
71
- config.password = 'YOUR PASSWORD'{ {/isBasic} }{ {#isApiKey} }
70
+ config.username = 'YOUR_USERNAME'
71
+ config.password = 'YOUR_PASSWORD'{ {/isBasicBearer} }{ {#isBasicBearer} }
72
+ # Configure Bearer authorization{ {#bearerFormat} } ({ {{.} }}){ {/bearerFormat} }: { {{name} }}
73
+ config.access_token = 'YOUR_BEARER_TOKEN'{ {/isBasicBearer} }{ {/isBasic} }{ {#isApiKey} }
72
74
# Configure API key authorization: { {{name} }}
73
75
config.api_key['{ {{keyParamName} }}'] = 'YOUR API KEY'
74
76
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
@@ -128,7 +130,10 @@ Class | Method | HTTP request | Description
128
130
- **API key parameter name**: { {keyParamName} }
129
131
- **Location**: { {#isKeyInQuery} }URL query string{ {/isKeyInQuery} }{ {#isKeyInHeader} }HTTP header{ {/isKeyInHeader} }
130
132
{ {/isApiKey} }
131
- { {#isBasic} }- **Type**: HTTP basic authentication
133
+ { {#isBasic} }
134
+ { {^isBasicBearer} }- **Type**: HTTP basic authentication
135
+ { {/isBasicBearer} }{ {#isBasicBearer} }- **Type**: Bearer authentication{ {#bearerFormat} } ({ {{.} }}){ {/bearerFormat} }
136
+ { {/isBasicBearer} }
132
137
{ {/isBasic} }
133
138
{ {#isOAuth} }
134
139
Original file line number Diff line number Diff line change @@ -27,10 +27,12 @@ Method | HTTP request | Description
27
27
require '{ {{gemName} }}'
28
28
{ {#hasAuthMethods} }
29
29
# setup authorization
30
- { {{moduleName} }}.configure do |config|{ {#authMethods} }{ {#isBasic} }
30
+ { {{moduleName} }}.configure do |config|{ {#authMethods} }{ {#isBasic} }{ {^isBasicBearer } }
31
31
# Configure HTTP basic authorization: { {{name} }}
32
32
config.username = 'YOUR USERNAME'
33
- config.password = 'YOUR PASSWORD'{ {/isBasic} }{ {#isApiKey} }
33
+ config.password = 'YOUR PASSWORD'{ {/isBasicBearer} }{ {#isBasicBearer} }
34
+ # Configure Bearer authorization{ {#bearerFormat} } ({ {{.} }}){ {/bearerFormat} }: { {{name} }}
35
+ config.access_token = 'YOUR_BEARER_TOKEN'{ {/isBasicBearer} }{ {/isBasic} }{ {#isApiKey} }
34
36
# Configure API key authorization: { {{name} }}
35
37
config.api_key['{ {{keyParamName} }}'] = 'YOUR API KEY'
36
38
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
Original file line number Diff line number Diff line change @@ -199,13 +199,27 @@ module {{moduleName}}
199
199
},
200
200
{ {/isApiKey} }
201
201
{ {#isBasic} }
202
+ { {^isBasicBearer} }
202
203
'{ {name} }' =>
203
204
{
204
205
type: ' basic' ,
205
206
in: ' header' ,
206
207
key: ' Authorization' ,
207
208
value: basic_auth_token
208
209
} ,
210
+ { {/isBasicBearer} }
211
+ { {#isBasicBearer} }
212
+ '{ {name} }' =>
213
+ {
214
+ type: ' bearer' ,
215
+ in: ' header' ,
216
+ {{#bearerFormat} }
217
+ format: '{ {{.} }}',
218
+ { {/bearerFormat} }
219
+ key: 'Authorization',
220
+ value: "Bearer #{ access_token} "
221
+ },
222
+ { {/isBasicBearer} }
209
223
{ {/isBasic} }
210
224
{ {#isOAuth} }
211
225
'{ {name} }' =>
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ Class | Method | HTTP request | Description
180
180
181
181
### bearer_test
182
182
183
- - ** Type** : HTTP basic authentication
183
+ - ** Type** : Bearer authentication (JWT)
184
184
185
185
### http_basic_test
186
186
Original file line number Diff line number Diff line change @@ -547,9 +547,8 @@ Fake endpoint to test group parameters (optional)
547
547
require ' petstore'
548
548
# setup authorization
549
549
Petstore .configure do |config |
550
- # Configure HTTP basic authorization: bearer_test
551
- config.username = ' YOUR USERNAME'
552
- config.password = ' YOUR PASSWORD'
550
+ # Configure Bearer authorization (JWT): bearer_test
551
+ config.access_token = ' YOUR_BEARER_TOKEN'
553
552
end
554
553
555
554
api_instance = Petstore ::FakeApi .new
Original file line number Diff line number Diff line change @@ -212,10 +212,11 @@ def auth_settings
212
212
} ,
213
213
'bearer_test' =>
214
214
{
215
- type : 'basic ' ,
215
+ type : 'bearer ' ,
216
216
in : 'header' ,
217
+ format : 'JWT' ,
217
218
key : 'Authorization' ,
218
- value : basic_auth_token
219
+ value : "Bearer #{ access_token } "
219
220
} ,
220
221
'http_basic_test' =>
221
222
{
You can’t perform that action at this time.
0 commit comments