bellycard/napa

Swagger throwing undefined method `collect' for nil:NilClass

craigulliott opened this issue · 1 comments

it appears grape-swagger doesn't support grapes use of the route_param block

This code works fine.

 desc 'Delete a question'
 params do
   requires :id, desc: 'ID of the question'
 end
 delete ':id' do
   Question.find(params[:id]).delete
   { success: true }
 end

This code below throws an error.

route_param :id do
   delete do
     Question.find(params[:id]).delete
     { success: true }
   end
 end

I'm logging this as an issue because the way we use Napa at Belly and the official grape examples result in this error. And it took me several hours to figure out what the cause was. Hopefully this helps someone else.

I think this is also related to #203 I was getting this same error, until I forced grape-swagger to ~> 0.9.0

gem 'grape-swagger', '~> 0.9.0'