Open
Description
If you mount a child API within a parent API, all helper methods are correctly inherited from parent to child, but not params helpers, for example:
class Child < Grape::API
get '/child' do
respond_with_ok
end
end
class Parent < Grape::API
helpers do
def respond_with_ok
{ status: 'ok' }
end
end
get '/parent' do
respond_with_ok
end
mount Child
end
$ curl http://127.0.0.1:8080/parent # => {:status=>"ok"}
$ curl http://127.0.0.1:8080/child # => {:status=>"ok"}
The same doesn't really work for params, e.g:
class Child < Grape::API
params do
use :page
end
get '/child' do
params
end
end
class Parent < Grape::API
helpers do
params :page do
optional :page, type: Integer
end
end
params do
use :page
end
get '/parent' do
params
end
mount Child
end
Results in a:
RuntimeError: Params :page not found!