This issue can't be edited
Because it belongs to an archived project. Jira admins can restore projects from the archive.
Support interpolation of dynamically set message parameters
Description
Environment
is fixed by
Activity

Gunnar Morling December 17, 2012 at 8:27 PM
See http://lists.jboss.org/pipermail/beanvalidation-dev/2012-December/000684.html:
I think this would be helpful where validation is based on some sort of context which is not expressed in the constraint annotation attributes:
"Password must be at least {min} characters long for users in role {role}" (role is retrieved from the current user)
"Order number invalid. Reason: {reason}" (reason is one of several possible ones checked by the validator)
One could work around this by creating the message completely by yourself, but I think it would be nice to leave retrieval of the template etc. to BV and just put custom variables in. In combination with the EL feature, you could also put in variables evaluated in the EL expression.
Emmanuel Bernard December 17, 2012 at 8:04 PM
I guess a key referencing now for i18n is such a use case. But one need String formatting as well to properly format objects like dates.
Emmanuel Bernard December 17, 2012 at 8:03 PM
Any use case besides now? This problem could be fixed with concatenating the date to the template directly instead of asking the message interpolation engine to do the job.
Details
Assignee
UnassignedUnassignedReporter
Gunnar MorlingGunnar MorlingParticipants
Emmanuel Bernard
Gunnar MorlingComponents
Affects versions
Priority
Major
Details
Details
Assignee
Reporter

Participants

Based on a question on stackoverflow, there seem to be use cases for setting message parameters dynamically, e.g. to put a dynamically determined valid value into the message:
If we don't find enough time for this, we should at least add an
unwrap()
method onConstraintValidatorContext
to allow for provider specific implementations.