Closed jekku closed 2 years ago
@Adzz should/can we change the null error message as well?
From
Field was marked as not null but was found to be null.
To be something like
Field was marked as not optional but was found to be #{inspect(value_found)}.
The error type should change as well after the draft.
It's currently:
%DataSchema.Errors.null_error{}
I imagine it to be something along the lines of:
%DataSchema.Errors.empty_required_value_error{}
should/can we change the null error message as well?
The error type should change as well
Yes please! ❤️
Small non blocking comment but great work overall, thanks!
What's here?
:optional?
which allows us to declare what kind of values are considered to be emptyDeclaring Wallets with an account number, among any of
["", nil, :undefined]
will cause an error.Rundown of changes
The preprocessor of
DataSchema.to_struct/5
now takes all the opts (as keywords) and transforms them to a map. Sensible defaults are provided when some opts are not provided. This enforces matches in the private functions that process the fields.Elixir is updated to 1.13 (I cannot make it run with the current version for some reason)
Some conditionals have been flattened
A new error for required empty values has been added