Next-gen ruby libs! » github.com/dry-rb » website: https://dry-rb.org » forum: https://discourse.dry-rb.org
dry-web-roda
and all the libraries
involves to make it work http://gustavocaso.github.io/2017/05/dry-web-roda-for-rails-developers_part_i/ any thoughts, comments, typos etc.. will be much appreciated
Hi all. I'm not sure this is the right channel to ask for help. I'm unsure whether I found a bug in dry-validations or I'm misusing it.
require "dry-struct"
require "dry-types"
require "dry-validation"
module Types
include Dry::Types.module
end
Dry::Validation.load_extensions(:monads)
Dry::Validation.load_extensions(:struct)
class Flags < Dry::Struct::Value
attribute :admin, Types::Strict::Bool
end
PersonValidation = Dry::Validation.Schema {
required(:name).filled(:str?)
required(:flags).schema(Flags)
}
output = PersonValidation.call({})
puts output.to_either
=> /Users/ric/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/dry-validation-0.10.7/lib/dry/validation/message_set.rb:113:in `[]': no implicit conversion of Symbol into Integer (TypeError)
The expectation was Left({:name=>["is missing"], :flags=>["is missing"]})
. Am I missing anything or I hit a bug with schemas + to_either?
to_either(hints: false)