solnic on master
Cast identifier to String durin… Merge pull request #169 from ad… (compare)
oh no, the example is wrong. It should no be nested in another
en: errors: rules: user: filled?: "name cannot be blank" rules: address: filled?: "You gotta tell us where you live"
en: errors: rules: user: filled?: "name cannot be blank" address: filled?: "You gotta tell us where you live"
messages = Dry::Validation::Messages::YAML.load(['/tmp/errors.yml']) user_messages = messages.namespaced(:user) user_messages[:filled?, rule: :address] # => "You gotta tell us where you live"
required(:status, Status)but that didn't seem to work
Hi. First of all thank you for great
dry-rb gems. Dry-v is awesome! :) I have a problem. I would like to build form schema where some fields are known and some other fields should be dynamically created. I thought that I use
Form.with(custom_struct: custom_struct).(params) with
configure block [like here: http://dry-rb.org/gems/dry-validation/custom-validation-blocks/] but it doesn't work. I cannot use
custom_struct inside the schema definition:
Form = Dry::Validation.Form do configure do option :custom_struct end required(:name).filled(:str?) required(:surname).filled(:str?) optional(:custom).schema do # error: "undefined method `each' for #<UnboundMethod:0x007f91b9978608> (NoMethodError)" custom_struct.each do |element| required(element.name) end end end
I've found this topic [https://discuss.dry-rb.org/t/build-dry-validations-dynamically/164] in the forum but need some examples. Could you help me somehow? Thanks!
Dry::Typesas my sample library. Figured I would share here :P https://github.com/backus/yardcheck
Dry::Types::Typeso that a ton of the params and returns didn't have to be like
# @return [Constrained, Definition, Sum, Safe]