Sha256: dd4c480971996b0305db667caa6cc40008fdae575cbd9c74a716e0712459a521

Contents?: true

Size: 239 Bytes

Versions: 26

Compression:

Stored size: 239 Bytes

Contents

require 'json'
require 'dry-validation'

schema = Dry::Validation.JSON do
  required(:email).filled

  required(:age).filled(:int?, gt?: 18)
end

errors = schema.call(JSON.parse('{"email": "", "age": "18"}')).messages

puts errors.inspect

Version data entries

26 entries across 26 versions & 1 rubygems

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