-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hi, i've an issue :'(
In this configuration, the route nearby_missions doesn't work and grape kick me with an error :
{
error: "id is invalid"
}
resource :missions do
desc "Return a mission."
params do
requires :id, type: Integer, desc: "Mission id."
end
route_param :id do
get do
authenticate!
Mission.find(params[:id]
end
end
desc "Return nearby missions."
params do
requires :latitude, type: Float#, values: -90.0..+90.0
requires :longitude, type: Float#, values: -180.0..+180.0
end
get 'nearby_missions' do
authenticate!
Mission.nearby_missions(params[:latitude], params[:longitude],params[:options])
end
end
but with this configuration everything is ok.
resource :missions do
desc "Return nearby missions."
params do
requires :latitude, type: Float#, values: -90.0..+90.0
requires :longitude, type: Float#, values: -180.0..+180.0
end
get 'nearby_missions' do
authenticate!
Mission.nearby_missions(params[:latitude], params[:longitude],params[:options])
end
desc "Return a mission."
params do
requires :id, type: Integer, desc: "Mission id."
end
route_param :id do
get do
authenticate!
Mission.find(params[:id]
end
end
end
I don't understand why the position of this code affects my API.
Someone would have any idea ?
Thx !
Metadata
Metadata
Assignees
Labels
No labels