Skip to content

Combine namespaces with their mount_path to allow APIs with specified mount_paths #505

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 22, 2016

Conversation

KevinLiddle
Copy link
Contributor

@KevinLiddle KevinLiddle commented Sep 21, 2016

I kept getting the following error when I tried to upgrade my grape and grape-swagger libraries:

/usr/local/rvm/gems/ruby-2.2.2/gems/grape-swagger-0.20.3/lib/grape-swagger.rb:97:in `block in combine_namespace_routes': undefined method `reject' for nil:NilClass (NoMethodError)

which I traced back to how the namespaced routes are collected. The app I'm working on has a bunch of APIs, all mounted with a specified mount_path:

mount SomeAPI => "/some_api"

so this PR should fix the issue of generating proper swagger docs with APIs that have been mounted to a specific route. I think this makes sense, but let me know if I'm mistaken about something here.

@LeFnord
Copy link
Member

LeFnord commented Sep 21, 2016

@KevinLiddle … thanks, this is really cool 👍

… mount_paths

i.e. `mount SomeAPI => '/some_api'`
end

Class.new(Grape::API) do
mount namespaced_api => '/mounted'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use ruby 2+ Hash style?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespaced_api is a variable so I don't think I can

@LeFnord LeFnord merged commit e755999 into ruby-grape:master Sep 22, 2016
@KevinLiddle
Copy link
Contributor Author

Thanks @LeFnord! Would you happen to have an idea of when this could get released?

LeFnord pushed a commit to LeFnord/grape-swagger that referenced this pull request Feb 9, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants