You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by ad...@apache.org on 2026/04/28 09:25:47 UTC

(polaris) branch main updated: Suppress Hibernate Validator HV000271 deprecation warnings (#4294)

This is an automated email from the ASF dual-hosted git repository.

adutra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new f1ec35bc07 Suppress Hibernate Validator HV000271 deprecation warnings (#4294)
f1ec35bc07 is described below

commit f1ec35bc074b0759b99ea08908df024748a0ec12
Author: Alexandre Dutra <ad...@apache.org>
AuthorDate: Tue Apr 28 11:25:41 2026 +0200

    Suppress Hibernate Validator HV000271 deprecation warnings (#4294)
    
    The OpenAPI-generated model classes triggered `HV000271` warnings on
    startup because the `pojo.mustache` template emitted a field-level
    `@Valid` annotation on container types (List/Set) in addition to the
    type-argument-level `@Valid` (e.g. `List<@Valid T>`), which Hibernate
    Validator 9 deprecates.
    
    This PR changes the template to skip the field-level `@Valid` when the
    field is a container.
    
    The same warning fired for the `properties` field of `Catalog`
    because the generated `CatalogProperties` class extends
    `HashMap<String, String>`, which Hibernate also treats as a
    container.
    
    This specific case was harder to solve. This PR introduces an
    `x-polaris-skip-valid-annotation` vendor extension to opt-out
    individual fields, and applies this annotation to `Catalog.properties`.
---
 server-templates/pojo.mustache      | 4 ++--
 spec/polaris-management-service.yml | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/server-templates/pojo.mustache b/server-templates/pojo.mustache
index 56849730d3..a8c15b3c21 100644
--- a/server-templates/pojo.mustache
+++ b/server-templates/pojo.mustache
@@ -21,8 +21,8 @@ It is updated to remove all swagger annotations and support builders and immutab
 {{#vendorExtensions.x-field-extra-annotation}}
     {{{vendorExtensions.x-field-extra-annotation}}}
 {{/vendorExtensions.x-field-extra-annotation}}
-{{#useBeanValidation}}{{>beanValidation}}{{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}  @Valid
-{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}{{/useBeanValidation}}  private final {{{datatypeWithEnum}}} {{name}};{{/vars}}
+{{#useBeanValidation}}{{>beanValidation}}{{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}{{^isContainer}}{{^vendorExtensions.x-polaris-skip-valid-annotation}}  @Valid
+{{/vendorExtensions.x-polaris-skip-valid-annotation}}{{/isContainer}}{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}{{/useBeanValidation}}  private final {{{datatypeWithEnum}}} {{name}};{{/vars}}
 {{#vars}}
     /**
     {{#description}}
diff --git a/spec/polaris-management-service.yml b/spec/polaris-management-service.yml
index 3b1082792c..fdac6319b9 100644
--- a/spec/polaris-management-service.yml
+++ b/spec/polaris-management-service.yml
@@ -858,6 +858,7 @@ components:
           description: The name of the catalog
         properties:
           type: object
+          x-polaris-skip-valid-annotation: true
           properties:
             default-base-location:
               type: string