Skip to content

@NotEmpty no longer translated to minLength = 1 #3191

@Marije-de-Heus

Description

@Marije-de-Heus

Describe the bug

In version 2.8.14, the @notempty annotation is translated to minLength = 1:
@RequestHeader(LoggingConstants.KEY_GEBRUIKER_LABEL) @notempty(message = LoggingConstants.VALIDATIE_LOG_WAARDE_VERPLICHT) final String actor,

translates to:

    "parameters": [
      {
        "name": "gebruiker",
        "in": "header",
        "required": true,
        "schema": {
          **"minLength": 1,**
          "type": "string"
        }
      },

In 2.8.15 minLength is gone:
"parameters": [
{
"name": "gebruiker",
"in": "header",
"required": true,
"schema": {
"type": "string"
}
},

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using? 3.5.9
  • What modules and versions of springdoc-openapi are you using? ****

    org.springdoc
    springdoc-openapi-ui
    1.8.0


    org.springdoc
    springdoc-openapi-starter-webmvc-ui
    2.8.15
  • What is the actual and the expected result using OpenAPI Description (yml or json)? See above
  • Provide with a sample code (HelloController) or Test that reproduces the problem See above

Expected behavior
MinLength = 1 is desirable when @notempty is used.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Workaround: replace @notempty by @SiZe(min = 1). This is not desirable for us.

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions