These are chat archives for dry-rb/chat
Next-gen ruby libs! » github.com/dry-rb » website: https://dry-rb.org » forum: https://discourse.dry-rb.org
some example code along the lines of:
# active_model: validates_presence_of :name validates_numericality_of :age, greater_than: 18 # dry required(:name)... # whatever would be a similar validation required(:age)...
and a brief description of how these validations are actually slightly different (e.g. dry is checking for the presence of a key but AM isn't)
Hi folks. Really enjoying everyones work on the dry-rb gems. I hope to pull some of them into our projects. I have a question regarding validation, more specifically dynamically defining schemas.
My scenario is that users can configure their own registration forms - basically what fields they see as mandatory - so I need a way to dynamically create a schema and use it for validating the required fields and ideally also enforce sensible formatting validations. Can anyone see a way to accomplish this? Does this scenario fit into the realms of dry-validation philosophy?
filled = !key.nil? && !value.nil? && !value.empty??