-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hi folks, thanks a lot for this great project!
I have a question regarding Bean Validation annotations on generic type arguments (Java 8+ type-use annotations).
Current behavior
Given a JSON Schema that represents an array of objects, jsonschema2pojo generates:
@Valid
private List<TaskItem> _do = new ArrayList<>();This places @Valid on the container (List) instead of on the type argument.
Expected / desired output
Ideally, the generated code would use a type-use annotation on the generic argument:
@Valid
private List<@Valid TaskItem> _do = new ArrayList<>();(or even just List<@Valid TaskItem> depending on configuration)
This style is supported since Java 8 and is the recommended approach in Jakarta Bean Validation for expressing cascaded validation on collection elements.
Question
Is it possible (or planned) to support generating type-use annotations on generic type arguments? If not currently supported, would it be feasible to extend the API (e.g. via SchemaRule, Annotator, or another extension point) to enable this?