mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-20 07:12:49 +12:00
fix: remove system added error vars to ensure deduplication works properly
This commit is contained in:
parent
57dfbab56e
commit
fceed874e6
2 changed files with 4 additions and 5 deletions
|
@ -187,6 +187,8 @@ defmodule AshPhoenix.FormData.Helpers do
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
# Drop known system added vars
|
||||||
|
|> Keyword.drop([:path, :index, :field, :message])
|
||||||
end
|
end
|
||||||
|
|
||||||
def transform_error(form, error) do
|
def transform_error(form, error) do
|
||||||
|
|
|
@ -861,16 +861,13 @@ defmodule AshPhoenix.FormTest do
|
||||||
# Note: I'm not 100% which of the 3 errors messages are preferred. The opts are get_text bindings for error translation
|
# Note: I'm not 100% which of the 3 errors messages are preferred. The opts are get_text bindings for error translation
|
||||||
# In the Phoenix core components the error translation is done `Gettext.dpgettext(MyApp.Gettext, domain, msgctxt, msgid, bindings)` with our tuple being `{msgid, bindings}`
|
# In the Phoenix core components the error translation is done `Gettext.dpgettext(MyApp.Gettext, domain, msgctxt, msgid, bindings)` with our tuple being `{msgid, bindings}`
|
||||||
assert Keyword.get_values(inputs_for_nested_form.errors, :limit) == [
|
assert Keyword.get_values(inputs_for_nested_form.errors, :limit) == [
|
||||||
{"is invalid", [field: "limit", message: "is invalid", index: 0]}
|
{"is invalid", []}
|
||||||
]
|
]
|
||||||
|
|
||||||
assert Keyword.get_values(inputs_for_nested_form.errors, :four_chars) == [
|
assert Keyword.get_values(inputs_for_nested_form.errors, :four_chars) == [
|
||||||
{"must have length of exactly %{exact}",
|
{"must have length of exactly %{exact}",
|
||||||
[
|
[
|
||||||
field: "four_chars",
|
exact: 4
|
||||||
message: "must have length of exactly %{exact}",
|
|
||||||
exact: 4,
|
|
||||||
index: 0
|
|
||||||
]}
|
]}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue