module Grape::DSL::Validations::ClassMethods

def contract(contract = nil, &block)

Other tags:
    Yield: - a block yielding a new instance of Dry::Schema::Params

Parameters:
  • contract (Class | Dry::Schema::Processor) --
def contract(contract = nil, &block)
  raise ArgumentError, 'Either contract or block must be provided' unless contract || block
  raise ArgumentError, 'Cannot inherit from contract, only schema' if block && contract.respond_to?(:schema)
  Grape::Validations::ContractScope.new(self, contract, &block)
end

def params(&block)

Other tags:
    Yield: - instance context of the new scope
def params(&block)
  Grape::Validations::ParamsScope.new(api: self, type: Hash, &block)
end

def reset_validations!

end
# whatever
post '/next' do
end
# params for the endpoint below this block
params do

# somewhere between them the reset_validations! method gets called

end
# whatever
post '/current' do
end
# params for the endpoint below this block
params do

settings, so next endpoint won't interfere with previous one.
Clears all defined parameters and validations. The main purpose of it is to clean up
def reset_validations!
  unset_namespace_stackable :declared_params
  unset_namespace_stackable :validations
  unset_namespace_stackable :params
end