Skip to content

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

Closed
@jakvbs

Description

@jakvbs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions