martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
424 stars 24 forks source link

Add support for model and schema email fields #30

Closed ellmetha closed 1 year ago

ellmetha commented 2 years ago

Description

It should be possible to easily define email fields in models and schemas. Both fields implementation should contribute the right validation logic in order to ensure that only valid emails are accepted.

Email model field definition:

class User < Marten::Model
  field :contact_email, :email, blank: true, null: true
end

Email schema field definition:

class UserSchema < Marten::Schema
  field :contact_email, :email, required: false
end