Module: Rack::App::SingletonMethods::ParamsValidator

Included in:
Rack::App::SingletonMethods
Defined in:
lib/rack/app/singleton_methods/params_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_params(&block) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/rack/app/singleton_methods/params_validator.rb', line 2

def validate_params(&block)
  descriptor = Rack::App::Middlewares::Params::Definition.new(&block).to_descriptor
  route_registration_properties[:params]= descriptor
  next_endpoint_middlewares do |builder|
    builder.use(Rack::App::Middlewares::Params::Setter)
    builder.use(Rack::App::Middlewares::Params::Validator, descriptor)
    builder.use(Rack::App::Middlewares::Params::Parser, descriptor)
  end
end