As in Ecto, we have changeset and in the case of invalid changeset, we can traverse errors according to Traverse error. But this gave us a very complicated JSON such as
{
"to_date": [
"can't be blank"
],
"title": [
"can't be blank"
],
"requested_by": [
"can't be blank"
],
"from_date": [
"can't be blank"
],
"exid": [
"can't be blank"
]
}
can't we do something wth that in Elixir so we can get the straight strings such as "Exid can't be blank" or such as an object
{
to_date: "to_date can't be bank"
}
Update: This is the result after traversing errors
%{exid: ["can't be blank"], from_date: ["can't be blank"],
requested_by: ["can't be blank"], title: ["can't be blank"],
to_date: ["can't be blank"]}
is there any way to get "exid cant be blank" by using Enum?