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

Wrong doc when use @Accessors(chain = true) with JsonProperty.Access.WRITE_ONLY #994

Closed
John-Chan opened this issue Dec 18, 2020 · 4 comments

Comments

@John-Chan
Copy link

John-Chan commented Dec 18, 2020

Describe the bug

code

1-src

swagger-ui

1

If I remove @JsonProperty(access = JsonProperty.Access.WRITE_ONLY),

2-src

2

Additional context

  • springdoc-openapi.version : 1.5.0
  • spring-boot.version : 2.3.5.RELEASE
@bnasslahsen
Copy link
Contributor

Not reproducible.
Make sure you provide a Minimal, Reproducible Example - with HelloController that reproduces the problem
This ticket will be closed and can be reopened if any relevant information is provided.

@John-Chan
Copy link
Author

Demo project : https://github.com/John-Chan/springdoc-issue994

$ diff UserA.java UserB.java
7d6
< import lombok.experimental.Accessors;
19c18
< @Accessors(chain = true)
---
> //@Accessors(chain = true)
21c20
< public class UserA implements Serializable {
---
> public class UserB implements Serializable {

DOC

  • Use @Accessors(chain = true) And @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) can reproduces the problem.
  • Remove one of them can solve the problem.

@John-Chan
Copy link
Author

Not reproducible.
Make sure you provide a Minimal, Reproducible Example - with HelloController that reproduces the problem
This ticket will be closed and can be reopened if any relevant information is provided.

please check my demo project @bnasslahsen

@bnasslahsen
Copy link
Contributor

@John-Chan,

First i note that you haven mentioned lombok @Accessors, in your initial description...
Your issue coms from chain = true, combined with @Accessors, which doesn't generate standard Java Bean Getters/Setters.

You could remove chain = true as workaround. Or add the missing setter manually.
Note that this behavior is not handled in springodc-openapi code. But the usage of standard Getters/Setters, comes from the swagger-core directly.

@bnasslahsen bnasslahsen changed the title Wrong doc when use JsonProperty.Access.WRITE_ONLY Wrong doc when use @Accessors(chain = true) with JsonProperty.Access.WRITE_ONLY Dec 21, 2020
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