Skip to content

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

@zqq90

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.

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