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
at a high level, why do we need both types and validations? i.e., considering something like:
UserSchema = Dry::Validation.Schema do required(:name).filled required(:email).filled(format?: EMAIL_REGEX) # etc..
it seems to me that a schema like this would be implied by a User type like, e.g.:
class User < Dry::Struct attribute :name, Types::Strict::String attribute :email, Types::Email # would be defined in Types module with regex # etc... end
i.e., even though the schema might be used a bit differently in code, in the context of a form validation for example, the schema could be mechanically derived from the User type? and so it would be redundant to have both. what am i missing?