Skip to content

Empty description attribute causes codegenerators to make empty comments #2035

Closed
@FireRedDev

Description

@FireRedDev

Describe the bug

When converting Javadoc to Swagger springdoc-openapi-javadoc generates the description attribute for every class even without any javadoc present in the class and leaves it empty. This causes generators like https://openapi-generator.tech/ to generate empty comments on our entities/dtos in our angular http client code generated automatically. Please dont include the property if its an empty string.

To Reproduce
Steps to reproduce the behavior: Generate Swagger JSON using URL for a Class without JavaDoc

  • What version of spring-boot you are using?
  • What modules and versions of springdoc-openapi are you using?
        <org.springdoc.version>1.6.13</org.springdoc.version>
- <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>${org.springdoc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-javadoc</artifactId>
            <version>1.6.13</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-data-rest</artifactId>
            <version>${org.springdoc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-security</artifactId>
            <version>${org.springdoc.version}</version>
        </dependency>
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
  • Provide with a sample code (HelloController) or Test that reproduces the problem

 "AddressAdditionDto": {
        "type": "object",
        "properties": {
          "addition": {
            "type": "string"
          },
          "addressId": {
            "type": "integer",
            "format": "int64"
          },
          "shoppingCartId": {
            "type": "integer",
            "format": "int64"
          }
        },
        "description": ""
      },

Expected behavior


 "AddressAdditionDto": {
        "type": "object",
        "properties": {
          "addition": {
            "type": "string"
          },
          "addressId": {
            "type": "integer",
            "format": "int64"
          },
          "shoppingCartId": {
            "type": "integer",
            "format": "int64"
          }
        }
      },

Screenshots

MicrosoftTeams-image (10)

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