Sha256: 315adc7b7cd7284fff8e7b9ad22059a981bc4c6912e53c2eb111952b8540432a

Contents?: true

Size: 407 Bytes

Versions: 26

Compression:

Stored size: 407 Bytes

Contents

require 'dry-validation'

schema = Dry::Validation.Schema do
  required(:address).schema do
    required(:city).filled(min_size?: 3)

    required(:street).filled

    required(:country).schema do
      required(:name).filled
      required(:code).filled
    end
  end
end

errors = schema.call({}).messages

puts errors.inspect

errors = schema.call(address: { city: 'NYC' }).messages

puts errors.inspect

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
dry-validation-0.9.4 examples/nested.rb
dry-validation-0.9.3 examples/nested.rb
dry-validation-0.9.2 examples/nested.rb
dry-validation-0.9.1 examples/nested.rb
dry-validation-0.9.0 examples/nested.rb
dry-validation-0.8.0 examples/nested.rb