Code of Conduct
AI Policy
Versions
erlang 28.1
elixir 1.19.0-otp-28
pipx 1.8.0
Operating system
MacOS
Current Behavior
manage_relationship validation returns only one error for multiple invalid related records
%Ash.Error.Invalid{
errors: [
%Ash.Error.Changes.Required{
field: :required_attribute,
type: :attribute,
path: [:other_resources, 0]
},
]
}
Currently, it returns only one error, even though there are two invalid related records in other_resources.
The expectation is that each invalid related item should produce its own error with the correct path, instead of collapsing them into a single error.
Reproduction
Reproduction Repo
https://github.com/tunchamroeun/ash
Run
mix test test/manage_relationship_test.exs
Reproduction test:
Expected Behavior
Given this input:
input = %{
name: "Test Parent Resource",
other_resources: [
%{
required_attribute: nil,
order: 0
},
%{
required_attribute: nil,
order: 1
}
]
}
It should return two validation errors, one for each invalid related record:
%Ash.Error.Invalid{
errors: [
%Ash.Error.Changes.Required{
field: :required_attribute,
type: :attribute,
path: [:other_resources, 0]
},
%Ash.Error.Changes.Required{
field: :required_attribute,
type: :attribute,
path: [:other_resources, 1]
}
]
}
Code of Conduct
AI Policy
Versions
erlang 28.1
elixir 1.19.0-otp-28
pipx 1.8.0
Operating system
MacOS
Current Behavior
manage_relationship validation returns only one error for multiple invalid related records
Currently, it returns only one error, even though there are two invalid related records in
other_resources.The expectation is that each invalid related item should produce its own error with the correct path, instead of collapsing them into a single error.
Reproduction
Reproduction Repo
https://github.com/tunchamroeun/ash
Run
mix test test/manage_relationship_test.exsReproduction test:
Expected Behavior
Given this input:
It should return two validation errors, one for each invalid related record: