Skip to content
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

Renaming model property with JsonProperty disables description from JavaDoc #2315

Closed
zamirov opened this issue Jul 20, 2023 · 3 comments
Closed
Labels
wontfix This will not be worked on

Comments

@zamirov
Copy link

zamirov commented Jul 20, 2023

Describe the bug
While descriptions from JavaDoc normally work, if you rename json property, it looses JavaDoc description.

I presume somewhere inside it does not keep original property name and if the name gets change by JsonProperty it loses mapping with JavaDoc.

To Reproduce
Steps to reproduce the behavior:
Create Webflux API server.
Add controller with POST request using model class with a property.
Enable JavaDoc, generate Swagger - JavaDoc is used as description.
Add JsonProperty with different name over the property - description becomes empty.

  • What version of spring-boot you are using?
    3.1.1
  • What modules and versions of springdoc-openapi are you using?
    • springdoc-openapi-starter-webflux-ui: 2.1.0
    • therapi-runtime-javadoc: 0.15.0
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>com.github.therapi</groupId>
                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
                            <version>0.15.0</version>
                        </path>
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    Property description taken from JavaDoc becomes empty if JsonProperty is used.
   "properties": {
       "task_id": {
            "type": "string"
      }
    }

Expected property description from JavaDoc regardless of using JsonProperty attribute.

   "properties": {
       "task_id": {
            "type": "string",
            "description": "Test model property."
      }
    }
  • Provide with a sample code (HelloController) or Test that reproduces the problem
/**
 * Test model.
 */
@Data
@Builder
public class TestModel {
  /**
   * Test model property.
   */
  @JsonProperty("test_property")
  String property;
}

public class TestController {
  @PostMapping("test-request")
  public Mono<Void> testRequest(
      @RequestBody TestModel model) {
    return null;
}

Expected behavior

The property should change its name with JsonProperty but description should stay as per JavaDoc.

@bnasslahsen
Copy link
Contributor

@zamirov,

This is an enhancement, that is not planned for support.
Feel free to propose directly a PR if you feel it useful for the community.

@bnasslahsen bnasslahsen added the wontfix This will not be worked on label Jul 29, 2023
@zamirov
Copy link
Author

zamirov commented Aug 14, 2023

Does it mean SpringDoc dropped support for JavaDoc? As JavaDoc is now unusable with SpringDoc.

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Aug 14, 2023

@springdoc springdoc locked as too heated and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants