Skip to content

Descriptions from @ArraySchema has disappered after upgrading to 2.8.6 #2953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
seskildsen opened this issue Mar 27, 2025 · 1 comment
Closed

Comments

@seskildsen
Copy link

seskildsen commented Mar 27, 2025

  • A clear and concise description of what the bug is: the title of an issue is not enough

After upgrading from spring doc (springdoc-openapi-starter-webmvc-ui) from 2.7.0 to 2.8.6 descriptions from @ArraySchema has disappeared.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    3.4.4

  • What modules and versions of springdoc-openapi are you using?

        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
            <version>2.8.6</version>
        </dependency>

DTO Class:

public class ClassName {

  @Schema(description = "A text here1.")
  private String fieldName1;

  @ArraySchema(arraySchema = @Schema(description = "A text here2."))
  private List<String> fieldName2 = new ArrayList<>();
...
}
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    Actual result (api-docs):
...
  "components": {
    "schemas": {
          "ClassName": {
            "type": "object",
            "properties": {
              "fieldName1": {
                "type": "string",
                "description": "A text here1."
              },
              "fieldName2": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
...

Expected result:

...
  "components": {
    "schemas": {
          "ClassName": {
            "type": "object",
            "properties": {
              "fieldName1": {
                "type": "string",
                "description": "A text here1."
              },
              "fieldName2": {
                "type": "array",
                "description": "A text here2.",
                "items": {
                  "type": "string"
                }
              }
            }
          }
...

Expected behavior

I expect that the description from @ArraySchema appears in components schema.

What have I tried:
I have tried to change the @ArraySchema(arraySchema = @Schema(description = "A text here2.")) to @Schema(description = "A text here2.") but then the descriptions from @ArraySchema appears twice.

@bnasslahsen
Copy link
Collaborator

@seskildsen,

This is a regression in swagger-core with OAS 3.1: swagger-api/swagger-core#4836, swagger-api/swagger-core#4802

BTW, moving back to OAS 3.0: description will be present: springdoc.api-docs.version=openapi_3_0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants