You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for has_many and list_of fields if we return an empty list from a data accessor and the field is not optional we don't error.
Arguably we should because it is empty. The problem is for some input types (like maps. json) there may be a difference between "the value was provided and it was []" and "the value does not exist in the input data". This is the difference between: %{preferences: []} and %{}. We don't want to lose this distinction.
In ecto they have an option when casting empty_values which lets the user specify which values we should consider to be empty. If a field has any of those values returned from the data accessor when casting we treat them as nil for the purpose of the optionality check.
I wonder if a similar thing here could be useful...
The text was updated successfully, but these errors were encountered:
for has_many and list_of fields if we return an empty list from a data accessor and the field is not optional we don't error.
Arguably we should because it is empty. The problem is for some input types (like maps. json) there may be a difference between "the value was provided and it was
[]
" and "the value does not exist in the input data". This is the difference between:%{preferences: []}
and%{}
. We don't want to lose this distinction.In ecto they have an option when casting
empty_values
which lets the user specify which values we should consider to be empty. If a field has any of those values returned from the data accessor when casting we treat them as nil for the purpose of the optionality check.I wonder if a similar thing here could be useful...
The text was updated successfully, but these errors were encountered: