Skip to content

Example value for some methods is not presented properly in 2.4.0 #2548

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
avicentic opened this issue Mar 22, 2024 · 7 comments
Closed

Example value for some methods is not presented properly in 2.4.0 #2548

avicentic opened this issue Mar 22, 2024 · 7 comments

Comments

@avicentic
Copy link

Describe the bug

  • In version 2.4.0 on some POST methods Example value is not presented as a structured json file with initial values. In version 2.3.0 everything works well.

To Reproduce
Steps to reproduce the behavior:

  • Spring-boot version 3.2.3
  • springdoc-openapi version 2.4.0
  • Unfortunately, I cannot reproduce issue in a small demo project. It appears in production project that I cannot share.

More details

  • Function in Rest controller is:
    @PostMapping(value = "/authenticate") public ResponseEntity<AuthenticateResponse> authenticate(HttpServletRequest request, @RequestBody AuthenticateRequest authenticateRequest) { AuthenticateResponse authenticateResponse = authService.authenticate(authenticateRequest, httpRequestUtil.getClientIP(request)); return new ResponseEntity<>(authenticateResponse, HttpStatus.OK); }
  • AuthenticateRequest object is:
    @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder public class AuthenticateRequest { private String ou; private String username; private String password; private TokenGrantType grantType; private String refreshToken; }
    On swagger page schema for request body is presented properly:
    image
    but example value is dummy "string":
    image

With springdoc-openapi version 2.3.0 example value is presented as a valid json object:
image

Surprisingly, I have same issue with all rest methods within one controller file. Methods from another controller files has valid examples for request body's.

@noshua
Copy link

noshua commented Mar 22, 2024

Just noticed the same bug, all POSTs are affected. PUT, PATCH and GET are fine.

@stalinone
Copy link

I noticed this issue as well.

Additional info:

  • Service with many controllers/endpoints cannot show POST request body schema
  • Service with few controllers is able to show schemas.

The api-docs JSON is semantically the same.

Not sure if this is related to #2538. I cannot override library version as said.

@bnasslahsen
Copy link
Collaborator

@stalinone,

Try using The latest SNAPSHOT where the swagger-ui has been upgraded.

@avicentic
Copy link
Author

@bnasslahsen I could confirm that bug is fixed in snapshot version.

@chaouki-reply
Copy link

chaouki-reply commented Mar 28, 2024

@bnasslahsen Sorry to jump here in the discussion, is there a plan for a release soon?

@bnasslahsen
Copy link
Collaborator

Hopefully by the end of the month

@chaouki-reply
Copy link

@bnasslahsen Great, looking forward to it!

@springdoc springdoc locked as resolved and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants