Bug Report Checklist
Description
Hibernate 9.1 emits warnings about the deprecated use of @Valid on containers:
https://docs.hibernate.org/validator/9.1/whats-new/en-US/html_single/#_deprecating_the_use_of_valid_at_the_container_level
2026-04-24 13:49:27,838 WARN [org.hibernate.validator.internal.metadata.aggregated.CascadingMetaDataBuilder] (main) HV000271: Using `@Valid` on a container (java.util.List) is deprecated. You should apply the annotation on the type argument(s). Affected element: data
2026-04-24 13:49:27,838 WARN [org.hibernate.validator.internal.metadata.aggregated.CascadingMetaDataBuilder] (main) HV000271: Using `@Valid` on a container (java.util.List) is deprecated. You should apply the annotation on the type argument(s). Affected element: ItemList#getData()
openapi-generator version
7.21.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Sample API
version: 1.0.0
paths:
/items:
get:
summary: Get all items
operationId: listItems
responses:
'200':
description: A list of items
content:
application/json:
schema:
$ref: '#/components/schemas/ItemList'
components:
schemas:
ItemList:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Item'
total:
type: integer
Item:
type: object
properties:
id:
type: integer
example: 1
name:
type: string
Generation Details
java -jar openapi-generator-cli.jar generate -g jaxrs-spec -i openapi.yaml -p apiPackage=com.example.api -p modelPackage=com.example.model -p useJakartaEe=true
private @Valid List<@Valid Item> data = new ArrayList<>();
@ApiModelProperty(value = "")
@JsonProperty("data")
@Valid public List<@Valid Item> getData() {
return data;
}
Bug Report Checklist
Description
Hibernate 9.1 emits warnings about the deprecated use of @Valid on containers:
https://docs.hibernate.org/validator/9.1/whats-new/en-US/html_single/#_deprecating_the_use_of_valid_at_the_container_level
openapi-generator version
7.21.0
OpenAPI declaration file content or url
Generation Details
java -jar openapi-generator-cli.jar generate -g jaxrs-spec -i openapi.yaml -p apiPackage=com.example.api -p modelPackage=com.example.model -p useJakartaEe=true