Skip to content

Commit 7d24f86

Browse files
author
Tim Vandecasteele
committed
Merge branch 'pr/58'
2 parents 1fddab9 + f7000b6 commit 7d24f86

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Adding hidden endpoints - [@arturoherrero](https://github.com/arturoherrero).
66
* Fix: allow urls with `-` - [@dadario](https://github.com/dadario).
77
* Fix: mounting multiple documentations - [@Drakula2k](https://github.com/Drakula2k).
8+
* Fix: resource groupings for prefixed APIs - [@aew](https://github.com/aew).
89
* Your Contribution Here
910

1011
### 0.6.0 (June 19, 2013)

lib/grape-swagger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def add_swagger_documentation(options={})
1313

1414
@combined_routes = {}
1515
routes.each do |route|
16-
resource = route.route_path.match('\/([\w|-]*?)[\.\/\(]').captures.first
16+
resource = route.route_path.split(route.route_prefix).last.match('\/([\w|-]*?)[\.\/\(]').captures.first
1717
next if resource.empty?
1818
resource.downcase!
1919
@combined_routes[resource] ||= []

spec/non_default_api_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def app; SimpleApiWithMarkdown end
257257
end
258258
end
259259

260-
context "versioned API" do
260+
context "prefixed and versioned API" do
261261
before :all do
262262
class VersionedMountedApi < Grape::API
263263
prefix 'api'
@@ -278,7 +278,8 @@ class SimpleApiWithVersion < Grape::API
278278
def app; SimpleApiWithVersion end
279279

280280
it "parses version and places it in the path" do
281-
get '/swagger_doc/api.json'
281+
get '/swagger_doc/something.json'
282+
282283
JSON.parse(last_response.body)["apis"].each do |api|
283284
api["path"].should start_with "/api/v1/"
284285
end

0 commit comments

Comments
 (0)