module Dry::Validation

Main library namespace

@api public

Constants

BLOCK_OPTIONS_MAPPINGS

Mapping for block kwarg options used by block_options

@see Rule#block_options

DEFAULT_ERRORS_NAMESPACE

Path to the default errors locale file

DEFAULT_ERRORS_PATH

Path to the default errors locale file

DOT
DuplicateSchemaError

Error raised when trying to define a schema in a contract class that already has a schema

InvalidKeysError

Error raised when `rule` specifies one or more keys that the schema doesn't specify

MissingMessageError

Error raised when a localized message was not found

ROOT_PATH

Root path is used for base errors in hash representation of error messages

SchemaMissingError

Error raised during initialization of a contract that has no schema defined

VERSION

Public Class Methods

Contract(options = EMPTY_HASH, &block) click to toggle source

Define a contract and build its instance

@example

my_contract = Dry::Validation.Contract do
  params do
    required(:name).filled(:string)
  end
end

my_contract.call(name: "Jane")

@param [Hash] options Contract options

@see Contract

@return [Contract]

@api public

# File lib/dry/validation.rb, line 49
def self.Contract(options = EMPTY_HASH, &block)
  Contract.build(options, &block)
end
macros() click to toggle source

This is needed by Macros::Registrar

@api private

# File lib/dry/validation.rb, line 56
def self.macros
  Macros
end