Skip to content

Bug [Bean Validation]: Compilation error with array of strings with validations #925

@joschi

Description

@joschi

When modeling a schema object with an array property with items of type string and the minLength validation set, the generated code is missing an import to jakarta.validation.constraints.Size or the annotation must use its FQCN when using Bean Validation.

Example:

list:
  type: array
  items:
    type: string
    minLength: 1

Generated code: target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java

        /**
          * Some object to be validated
         **/
        @jakarta.ws.rs.QueryParam("_list")
        private List<@Size(min = 1)String> _list = null;

Compilation error:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[227,23] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject.ValidatedObjectQueryParam
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[332,22] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject.ValidatedObjectQueryParam
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[339,35] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject.ValidatedObjectQueryParam
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[343,54] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject.ValidatedObjectQueryParam
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[39,19] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[135,18] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[142,31] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject
[ERROR] ./client/integration-tests/bean-validation/target/generated-sources/open-api-yaml/org/openapi/quarkus/bean_validation_true_yaml/model/ValidatedObject.java:[146,40] cannot find symbol
  symbol:   class Size
  location: class org.openapi.quarkus.bean_validation_true_yaml.model.ValidatedObject

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clientThis item is related to the client extensionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions