Why do we need this improvement?
Modelina offers support for generating javax.* and jakarta.* Validation annotations. Properties which are contained in collections / containers like java.util.List and java.util.Set are annotated like this:
@Valid
public List<MyClass> myClasses;
Unfortunately in newer versions of Java Bean validation, this causes a warning, as this behavior is deprecated:
HV000271: Using `@Valid` on a container (java.util.List) is deprecated. You should apply the annotation on the type argument(s)
The recommended style which is safe in the future would be to annotate the type parameter instead of the container:
public List<@Valid MyClass> myClasses;
How will this change help?
This change will allow Java projects using asyncapi code generation to generate Java classes which do not cause deprecation warnings.
Screenshots
No response
How could it be implemented/designed?
To not make this a breaking change, I would introduce a new property/flag to control this behavior. The "old" behavior would still be the default, and the new one could be enabled by setting a flag to true, similar to the useJakarta property. The CLI should be able to pass the property to modelina, so the feature is available both in the generator and the CLI
🚧 Breaking changes
No
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue?
Yes I am willing to submit a PR!
Why do we need this improvement?
Modelina offers support for generating javax.* and jakarta.* Validation annotations. Properties which are contained in collections / containers like
java.util.Listandjava.util.Setare annotated like this:Unfortunately in newer versions of Java Bean validation, this causes a warning, as this behavior is deprecated:
The recommended style which is safe in the future would be to annotate the type parameter instead of the container:
How will this change help?
This change will allow Java projects using asyncapi code generation to generate Java classes which do not cause deprecation warnings.
Screenshots
No response
How could it be implemented/designed?
To not make this a breaking change, I would introduce a new property/flag to control this behavior. The "old" behavior would still be the default, and the new one could be enabled by setting a flag to
true, similar to theuseJakartaproperty. The CLI should be able to pass the property to modelina, so the feature is available both in the generator and the CLI🚧 Breaking changes
No
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue?
Yes I am willing to submit a PR!