Skip to content

[Bug]: Another ##default leaks case (version 2.2.44 and 2.2.45): @Parameter + @ArraySchema #5086

Closed

Description

@zqq90

Description of the problem/issue

##default leaks to parameters if annotated with @Parameter(array = @ArraySchema(...))

Affected Version

2.2.45

Earliest version the bug appears in (if known):
2.2.44

Steps to Reproduce

@GetMapping("/tests/default-leaks")
public IResponse<Void> testDefaultLeaks(
        DefaultLeaksParams params,
        @Parameter(
                array = @ArraySchema(minItems = 1)
        )
        List<String> directLeaks
) {
    return ok();
}

@org.springdoc.core.annotations.ParameterObject
public record DefaultLeaksParams(
        @Parameter(
                array = @ArraySchema(schema = @Schema(type = "string"))
        )
        List<String> leaks1,
        @Parameter(
                array = @ArraySchema(minItems = 1)
        )
        List<String> leaks2,
        @Parameter
        List<String> doesNotLeaks
) {
}

Expected Behavior

"##default" should not leaks to schema

Actual Behavior

"parameters": [
  {
      "name": "leaks1",
      "in": "query",
      "required": false,
      "schema": {
          "type": "array",
          "default": "##default",
          "items": {
              "type": "string"
          }
      }
  },
  {
      "name": "leaks2",
      "in": "query",
      "required": false,
      "schema": {
          "type": "array",
          "default": "##default",
          "minItems": 1
      }
  },
  {
      "name": "doesNotLeaks",
      "in": "query",
      "required": false,
      "schema": {
          "type": "array",
          "items": {
              "type": "string"
          }
      }
  },
  {
      "name": "directLeaks",
      "in": "query",
      "required": true,
      "schema": {
          "type": "array",
          "default": "##default",
          "minItems": 1
      }
  }
]

Logs / Stack Traces

Additional Context

Gradle Dependencies Report - testRuntimeClasspath

...
+--- io.swagger.core.v3:swagger-annotations-jakarta:2.2.45
+--- io.swagger.core.v3:swagger-core-jakarta:2.2.45
+--- org.springdoc:springdoc-openapi-starter-webmvc-ui -> 3.0.2

Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided sufficient information for maintainers to reproduce the issue.

Activity

  1. Mattias-Sehlstedt commented on Mar 11, 2026

    @Mattias-Sehlstedt
    Contributor

    Springdoc uses swagger-core 2.2.43, and has thus not adjusted for the breaking change that was introduced by defining ##default as the new default's default.

    So most likely the change needed is within springdoc so that its parameter processing has to account for ##default rather than "" when it looks for an empty default value.

  2. Mattias-Sehlstedt commented on Mar 13, 2026

    @Mattias-Sehlstedt
    Contributor

    The issue seems to be this code in springdoc.

  3. daniel-kmiecik commented on Apr 10, 2026

    @daniel-kmiecik
    Collaborator

    We have prepared a fix that restores the default value to an empty string. We apologize for the inconvenience.

  4. daniel-kmiecik commented on Apr 15, 2026

    @daniel-kmiecik
    Collaborator

    We have reverted the DEFAULT_SENTINEL change in version 2.2.28. We apologize for any inconvenience this may have caused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions