-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
User Story
As a developer, I want to define custom attribute types for my project so that I can better represent our domain's concepts and reuse these types across my specs.
Acceptance Criteria
TBD
Engineering Notes
Spec:
# attribute <name>, <type>
attribute :uuid, :uuidType module:
defmodule CustomTypes do
def uuid(value, opts) do
format = ~r/\A\d{5}\-\d{5}\-\d{5}\-\d{5}\-\d{5}\z/
case Regex.match?(format, value) do
true -> {:ok, value}
_ -> {:error, :wrong_format}
end
end
endConfig:
config :speck, custom_types: [CustomTypes]
# or because of compiler order...
config :speck, custom_type_path: "protocol/_types"