-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Hi, I found that validations do not run for route_param, here is a minimal example:
# file: route_param.ru
require 'grape'
class Bang < Grape::Validations::Base
def validate_param!(attr_name, params)
fail Grape::Exceptions::Validation, params: [@scope.full_name(attr_name)], message: 'bang'
end
end
class RouteParam < Grape::API
format :json
default_format :json
params do
requires :name, type: String, bang: true
end
route_param :name do
get do
present :name, params[:name]
end
end
end
run RouteParamRun with rackup route_param.ru and then curl localhost:9292/foo.
I expect a validation failed message, but instead I get {"name":"foo"}.
I am using version 0.14.0.
Updated: fix sample code typos