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.13.3 examples/nested.rb
dry-validation-0.13.2 examples/nested.rb
dry-validation-0.13.1 examples/nested.rb
dry-validation-0.11.2 examples/nested.rb
dry-validation-0.12.3 examples/nested.rb
dry-validation-0.13.0 examples/nested.rb
dry-validation-0.12.2 examples/nested.rb
dry-validation-0.12.1 examples/nested.rb
dry-validation-0.12.0 examples/nested.rb
dry-validation-0.11.1 examples/nested.rb
dry-validation-0.11.0 examples/nested.rb
dry-validation-0.10.7 examples/nested.rb
dry-validation-0.10.6 examples/nested.rb
dry-validation-0.10.5 examples/nested.rb
dry-validation-0.10.4 examples/nested.rb
dry-validation-0.10.3 examples/nested.rb
dry-validation-0.10.2 examples/nested.rb
dry-validation-0.10.1 examples/nested.rb
dry-validation-0.10.0 examples/nested.rb
dry-validation-0.9.5 examples/nested.rb