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

"application/json; charset=UTF-8" Skipped in Generated OpenAPI JSON #2596

Closed
jakvbs opened this issue May 21, 2024 · 0 comments · Fixed by #2600
Closed

"application/json; charset=UTF-8" Skipped in Generated OpenAPI JSON #2596

jakvbs opened this issue May 21, 2024 · 0 comments · Fixed by #2600

Comments

@jakvbs
Copy link

jakvbs commented May 21, 2024

Describe the bug

When I have the consumes parameter in my endpoint like this:

@PostMapping(value = "/{cardId}/lock", consumes = {"application/json;charset=UTF-8", "application/json; charset=UTF-8", "application/json"})

"application/json; charset=UTF-8" is skipped.

To Reproduce
Java: 17
Spring Boot: 3.2.5
Springdocs: 2.5.0

Expected behavior

"application/json; charset=UTF-8" should be present in the generated OpenAPI JSON file.

Additional context
I debugged this problem and found that it started occurring after this commit: Commit 1732dba, which fixed this issue: Issue 1546. The problem is in this section of the commit: Commit 1732dba - Line 272.

After adding the if (ArrayUtils.isEmpty(methodConsumes)) statement, we are skipping the overriding consume types. I believe instead of skipping this step when the consumes array is not empty, we should merge the values.

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

Successfully merging a pull request may close this issue.

1 participant