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
The error message from dry-validation for incorrect key nesting in en.yml file for rule with nested params is giving wrong path.
To Reproduce
Consider having such schema and some rule depending on several nested parameters.
params do
required(:data).hash do
required(:type).filled(:string)
required(:attributes).hash do
....
required(:phone_number).maybe(:string)
required(:phone_number_prefix).maybe(:string)
end
end
.....
end
rule(data: {attributes: [:phone_number, :phone_number_prefix]}) do
phone_number = ....
key.failure(:invalid) unless phone_number.valid?
end
I tried different nesting of keys in en.yml, but nothing worked. This was the last edit:
Which as many other tries was giving this error Dry::Validation::MissingMessageError: Message template for :invalid under "data.attributes.phone_number.phone_number_prefix" was not found for such schema
Expected behavior
Error message with valid path in yml file for such rule or which says that rule name should be written in another way.
Describe the bug
The error message from dry-validation for incorrect key nesting in en.yml file for rule with nested params is giving wrong path.
To Reproduce
Consider having such schema and some rule depending on several nested parameters.
I tried different nesting of keys in en.yml, but nothing worked. This was the last edit:
Which as many other tries was giving this error
Dry::Validation::MissingMessageError: Message template for :invalid under "data.attributes.phone_number.phone_number_prefix" was not found for such schema
Expected behavior
Error message with valid path in yml file for such rule or which says that rule name should be written in another way.
Discussion started here:
https://discourse.dry-rb.org/t/message-path-for-rule-with-very-nested-params/1257/3
The text was updated successfully, but these errors were encountered: