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
Full message of a key failure does not include the key name when the key is not translated and the failure method was called with a symbol message, e.g. key.failure(:is_invalid).
So the error message looks like " is invalid", instead of "foo is invalid".
Full message of a base failure starts with a space symbol, e.g. " the message".
To Reproduce
require"i18n"require"dry/validation"I18n.backend.store_translations(:en,{dry_validation: {errors: {is_invalid: "is invalid"}}})classMyContract < Dry::Validation::Contractconfig.messages.backend=:i18nparamsdorequired(:foo).value(:integer)endruledobase.failure("base failure here")endrule(:foo)dokey.failure(:is_invalid)endendMyContract.new.call(foo: 42).errors(full: true).map(&:text)#=> [" base failure here", " is invalid"]# Expected:#=> ["base failure here", "foo is invalid"]
Expected behavior
Full message of a key failure always starts with the key name, even if the key is not translated
Full message of a base failure includes just the message without the leading space symbol, e.g. "the message" instead of " the message"
Environment
ruby: 2.6.6
dry-validation: 1.5.2
The text was updated successfully, but these errors were encountered:
This issue was initially reported in discourse: https://discourse.dry-rb.org/t/inconsistency-in-resolving-full-error-messages/1091
Full message of a key failure does not include the key name when the key is not translated and the failure method was called with a symbol message, e.g.
key.failure(:is_invalid)
.So the error message looks like
" is invalid"
, instead of"foo is invalid"
.Full message of a base failure starts with a space symbol, e.g.
" the message"
.To Reproduce
Expected behavior
"the message"
instead of" the message"
Environment
ruby: 2.6.6
dry-validation: 1.5.2
The text was updated successfully, but these errors were encountered: