Sha256: 25a964818c6be71eee436217361663bcb188cb5247a31dc2fc9dee4e172af475

Contents?: true

Size: 385 Bytes

Versions: 5

Compression:

Stored size: 385 Bytes

Contents

require 'dry-validation'

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

    key(:street).required

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

errors = schema.call({}).messages

puts errors.inspect

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

puts errors.inspect

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dry-validation-0.7.4 examples/nested.rb
dry-validation-0.7.3 examples/nested.rb
dry-validation-0.7.2 examples/nested.rb
dry-validation-0.7.1 examples/nested.rb
dry-validation-0.7.0 examples/nested.rb