@@ -135,44 +135,75 @@ def app
135
135
} ,
136
136
'/simple-options-test' => {
137
137
'options' => {
138
- 'responses' => { '200' => { 'content' => { 'application/json' => { } } , 'description' => 'option SimpleOptionsTest' } } ,
138
+ 'responses' => {
139
+ '200' => { 'content' => { 'application/json' => { } } ,
140
+ 'description' => 'option SimpleOptionsTest' }
141
+ } ,
139
142
'tags' => [ 'simple-options-test' ] ,
140
143
'operationId' => 'optionsSimpleOptionsTest'
141
144
}
142
145
} ,
143
146
'/simple_with_headers' => {
144
147
'get' => {
145
148
'description' => 'this gets something else' ,
149
+ 'operationId' => 'getSimpleWithHeaders' ,
146
150
'parameters' => [
147
- { 'in' => 'header' , 'name' => 'XAuthToken' , 'description' => 'A required header.' , 'type' => 'string' , 'required' => true } ,
148
- { 'in' => 'header' , 'name' => 'XOtherHeader' , 'description' => 'An optional header.' , 'type' => 'string' , 'required' => false }
151
+ { 'description' => 'A required header.' ,
152
+ 'in' => 'header' ,
153
+ 'name' => 'XAuthToken' ,
154
+ 'required' => true ,
155
+ 'schema' => { 'type' => 'string' } } ,
156
+ {
157
+ 'description' => 'An optional header.' ,
158
+ 'in' => 'header' ,
159
+ 'name' => 'XOtherHeader' ,
160
+ 'required' => false ,
161
+ 'schema' => { 'type' => 'string' }
162
+ }
149
163
] ,
150
- 'tags' => [ 'simple_with_headers' ] ,
151
- 'operationId' => 'getSimpleWithHeaders' ,
152
- 'responses' => {
153
- '200' => { 'content' => { 'application/json' => { } } , 'description' => 'this gets something else' } ,
154
- '403' => { 'content' => { 'application/json' => { } } , 'description' => 'invalid pony' } ,
155
- '405' => { 'content' => { 'application/json' => { } } , 'description' => 'no ponies left!' }
156
- }
157
- }
158
- } ,
159
- '/items' => {
160
- 'post' => {
161
- 'description' => 'this takes an array of parameters' ,
162
- 'consumes' => [ 'application/json' ] ,
163
- 'parameters' => [ { 'in' => 'formData' , 'name' => 'items[]' , 'description' => 'array of items' , 'required' => false , 'type' => 'array' , 'items' => { 'type' => 'string' } } ] ,
164
- 'tags' => [ 'items' ] ,
165
- 'operationId' => 'postItems' ,
166
- 'responses' => { '201' => { 'description' => 'this takes an array of parameters' } }
164
+ 'responses' => { '200' => { 'content' => { 'application/json' => { } } ,
165
+ 'description' => 'this gets something else' } ,
166
+ '403' => { 'content' => { 'application/json' => { } } ,
167
+ 'description' => 'invalid pony' } ,
168
+ '405' => { 'content' => { 'application/json' => { } } ,
169
+ 'description' => 'no ponies left!' } } ,
170
+ 'tags' => [ 'simple_with_headers' ]
167
171
}
168
172
} ,
169
173
'/custom' => {
170
174
'get' => {
171
175
'description' => 'this uses a custom parameter' ,
172
- 'parameters' => [ { 'in' => 'formData' , 'name' => 'custom' , 'description' => 'array of items' , 'required' => false , 'type' => 'array' , 'items' => { 'type' => 'CustomType' } } ] ,
173
- 'tags' => [ 'custom' ] ,
174
176
'operationId' => 'getCustom' ,
175
- 'responses' => { '200' => { 'content' => { 'application/json' => { } } , 'description' => 'this uses a custom parameter' } }
177
+ 'responses' => { '200' => {
178
+ 'content' => { 'application/json' => { } } ,
179
+ 'description' => 'this uses a custom parameter'
180
+ } } ,
181
+ 'tags' => [ 'custom' ]
182
+ }
183
+ } ,
184
+ '/items' => {
185
+ 'post' => {
186
+ 'description' => 'this takes an array of parameters' ,
187
+ 'operationId' => 'postItems' ,
188
+ 'requestBody' => {
189
+ 'content' => {
190
+ 'application/x-www-form-urlencoded' => {
191
+ 'schema' => {
192
+ 'properties' => {
193
+ 'items[]' => {
194
+ 'description' => 'array of items' ,
195
+ 'items' => { 'type' => 'string' } ,
196
+ 'type' => 'array'
197
+ }
198
+ } , 'type' => 'object'
199
+ }
200
+ }
201
+ }
202
+ } ,
203
+ 'responses' => {
204
+ '201' => { 'description' => 'this takes an array of parameters' }
205
+ } ,
206
+ 'tags' => [ 'items' ]
176
207
}
177
208
}
178
209
}
@@ -255,8 +286,8 @@ def app
255
286
'get' => {
256
287
'description' => 'this gets something else' ,
257
288
'parameters' => [
258
- { 'in' => 'header' , 'name' => 'XAuthToken' , 'description' => 'A required header.' , 'type' => 'string' , 'required' => true } ,
259
- { 'in' => 'header' , 'name' => 'XOtherHeader' , 'description' => 'An optional header.' , 'type' => 'string' , 'required' => false }
289
+ { 'in' => 'header' , 'name' => 'XAuthToken' , 'description' => 'A required header.' , 'schema' => { ' type' => 'string' } , 'required' => true } ,
290
+ { 'in' => 'header' , 'name' => 'XOtherHeader' , 'description' => 'An optional header.' , 'schema' => { ' type' => 'string' } , 'required' => false }
260
291
] ,
261
292
'tags' => [ 'simple_with_headers' ] ,
262
293
'operationId' => 'getSimpleWithHeaders' ,
@@ -282,8 +313,20 @@ def app
282
313
'/items' => {
283
314
'post' => {
284
315
'description' => 'this takes an array of parameters' ,
285
- 'consumes' => [ 'application/json' ] ,
286
- 'parameters' => [ { 'in' => 'formData' , 'name' => 'items[]' , 'description' => 'array of items' , 'required' => false , 'type' => 'array' , 'items' => { 'type' => 'string' } } ] ,
316
+ 'requestBody' => {
317
+ 'content' => { 'application/x-www-form-urlencoded' => {
318
+ 'schema' => {
319
+ 'properties' => {
320
+ 'items[]' => {
321
+ 'description' => 'array of items' ,
322
+ 'items' => { 'type' => 'string' } ,
323
+ 'type' => 'array'
324
+ }
325
+ } ,
326
+ 'type' => 'object'
327
+ }
328
+ } }
329
+ } ,
287
330
'tags' => [ 'items' ] ,
288
331
'operationId' => 'postItems' ,
289
332
'responses' => { '201' => { 'description' => 'this takes an array of parameters' } }
@@ -300,14 +343,17 @@ def app
300
343
end
301
344
302
345
specify do
346
+ fail ( "TODO: Fix" )
303
347
expect ( subject [ 'paths' ] ) . to eq (
304
348
'/custom' => {
305
349
'get' => {
306
350
'description' => 'this uses a custom parameter' ,
307
- 'parameters' => [ { 'in' => 'formData' , 'name' => 'custom' , 'description' => 'array of items' , 'required' => false , 'type' => 'array' , 'items' => { 'type' => 'CustomType' } } ] ,
308
- 'tags' => [ 'custom' ] ,
309
351
'operationId' => 'getCustom' ,
310
- 'responses' => { '200' => { 'content' => { 'application/json' => { } } , 'description' => 'this uses a custom parameter' } }
352
+ 'responses' => {
353
+ '200' => { 'content' => { 'application/json' => { } } ,
354
+ 'description' => 'this uses a custom parameter' }
355
+ } ,
356
+ 'tags' => [ 'custom' ]
311
357
}
312
358
}
313
359
)
0 commit comments