File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 4
4
* Adding support for generating swagger responseClass and models from Grape Entities - [ @calebwoods ] ( https://github.com/calebwoods ) .
5
5
* Adding hidden endpoints - [ @arturoherrero ] ( https://github.com/arturoherrero ) .
6
6
* Fix: allow urls with ` - ` - [ @dadario ] ( https://github.com/dadario ) .
7
+ * Fix: mounting multiple documentations - [ @Drakula2k ] ( https://github.com/Drakula2k ) .
7
8
* Your Contribution Here
8
9
9
10
### 0.6.0 (June 19, 2013)
Original file line number Diff line number Diff line change @@ -337,4 +337,59 @@ def app; SimpleApiWithHiddenPaths; end
337
337
end
338
338
end
339
339
end
340
+
341
+ context "multiple documentations" do
342
+ before :all do
343
+ class FirstApi < Grape ::API
344
+ desc 'This is the first API'
345
+ get '/first' do
346
+ { first : 'hip' }
347
+ end
348
+
349
+ add_swagger_documentation mount_path : '/first/swagger_doc'
350
+ end
351
+
352
+ class SecondApi < Grape ::API
353
+ desc 'This is the second API'
354
+ get '/second' do
355
+ { second : 'hop' }
356
+ end
357
+
358
+ add_swagger_documentation mount_path : '/second/swagger_doc'
359
+ end
360
+
361
+ class SimpleApiWithMultipleMountedDocumentations < Grape ::API
362
+ mount FirstApi
363
+ mount SecondApi
364
+ end
365
+ end
366
+
367
+ def app ; SimpleApiWithMultipleMountedDocumentations ; end
368
+
369
+ it "retrieves the first swagger-documentation on /first/swagger_doc" do
370
+ get '/first/swagger_doc.json'
371
+ JSON . parse ( last_response . body ) . should == {
372
+ "apiVersion" => "0.1" ,
373
+ "swaggerVersion" => "1.1" ,
374
+ "basePath" => "http://example.org" ,
375
+ "operations" => [ ] ,
376
+ "apis" => [
377
+ { "path" => "/first/swagger_doc/first.{format}" }
378
+ ]
379
+ }
380
+ end
381
+
382
+ it "retrieves the first swagger-documentation on /second/swagger_doc" do
383
+ get '/second/swagger_doc.json'
384
+ JSON . parse ( last_response . body ) . should == {
385
+ "apiVersion" => "0.1" ,
386
+ "swaggerVersion" => "1.1" ,
387
+ "basePath" => "http://example.org" ,
388
+ "operations" => [ ] ,
389
+ "apis" => [
390
+ { "path" => "/second/swagger_doc/second.{format}" }
391
+ ]
392
+ }
393
+ end
394
+ end
340
395
end
You can’t perform that action at this time.
0 commit comments