Method: Grape::DSL::Validations::ClassMethods#contract
- Defined in:
- lib/grape/dsl/validations.rb
#contract(contract = nil) { ... } ⇒ Object
Declare the contract to be used for the endpoint’s parameters.
48 49 50 51 52 53 |
# File 'lib/grape/dsl/validations.rb', line 48 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 |