Conform.Type behaviour
Defines the behaviour for custom types.
Callbacks
Specs:
- parse_datatype(atom, term) :: {:ok, term} | {:error, term}
By default conform reads values as string. Implement your own conversion using this callback. If you implement your own conversion, you must return either {:ok, val} | {:error, reason}
Specs:
- to_doc(term) :: String.t | false
Return a string to produce documentation for the given type based on it’s valid values (if specified). Return false if you wish to instead use the documentation specified in the schema.
Specs:
- translate(mapping :: term, value :: term, acc :: [term]) :: term | {:error, term}
Translate an input value based on the provided mapping. Should return the translated value or {:error, reason}