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
Is your feature request related to a problem? Please describe.
On our project, we would like to specify individual error messages for each constraint (e.g. @Pattern or @Size). For this, there is already a vendor extension (x-pattern-message) in the BeanValidationCore.mustache template as an example. The problem is that while validation annotations are generated for non-container types, such as String, based on the mustache template, annotations for type arguments in containers are merged with the container type in the generator itself. Therefore, in such a case, we have no chance to provide a unique error message and we receive the default messages given by Jakarta.
Currently, annotations for type arguments are "hard-coded" (source) and assigned to the dataType along with the container type. It should be split into two separate variables and used in mustache templates that way. I think it would be good if the generator used the BeanValidationCore.mustache template (or a new one) for container types as well as for non-container types. This would provide the opportunity to take control over what we want the generator to do in these cases by customizing the mustache templates.
Note
If no one applies for the task, I will gladly take it on, because we really need this feature (or something similar) on the project :D
The text was updated successfully, but these errors were encountered:
DatApplePy
changed the title
[REQ][Java] Generate validation for type arguments in containers via mustache template
[REQ][Java][Spring] Generate validation for type arguments in containers via mustache template
Sep 17, 2024
Is your feature request related to a problem? Please describe.
On our project, we would like to specify individual error messages for each constraint (e.g.
@Pattern
or@Size
). For this, there is already a vendor extension (x-pattern-message
) in theBeanValidationCore.mustache
template as an example. The problem is that while validation annotations are generated for non-container types, such asString
, based on the mustache template, annotations for type arguments in containers are merged with the container type in the generator itself. Therefore, in such a case, we have no chance to provide a unique error message and we receive the default messages given by Jakarta.Non-container example:
Container example:
Describe the solution you'd like
Currently, annotations for type arguments are "hard-coded" (source) and assigned to the
dataType
along with the container type. It should be split into two separate variables and used in mustache templates that way. I think it would be good if the generator used theBeanValidationCore.mustache
template (or a new one) for container types as well as for non-container types. This would provide the opportunity to take control over what we want the generator to do in these cases by customizing the mustache templates.Note
If no one applies for the task, I will gladly take it on, because we really need this feature (or something similar) on the project :D
The text was updated successfully, but these errors were encountered: