Skip to content

buildApiResponses ignores produced ContentType in case of many @Operation #2477

@hexmind

Description

@hexmind

Describe the bug
one content type (a/a) is ignored

To Reproduce
Steps to reproduce the behavior:

  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    input:
    @Operation(description = "a")
    @GetMapping(path = "/", produces = "a/a")
    public String a() {
        return "A";
    }

    @Operation(description = "b")
    @GetMapping(path = "/", produces = "b/b")
    public String b() {
        return "B";
    }

actual result:

            "content":{
              "b/b":{
                "schema":{
                  "type":"string"
                }
              }
            }

A bug and solution are probably in GenericResponseService.java:
https://github.com/springdoc/springdoc-openapi/pull/2478/files#diff-bde5de3f4d4588ddcb3a1efb697aa8fc5fd857d63bc4e1d003d10d55d1e973cf

Expected behavior

        "responses":{
          "200":{
            "description":"OK",
            "content":{
              "b/b":{
                "schema":{
                  "type":"string"
                }
              }
              ,"a/a":{
                "schema":{
                  "type":"string"
                }
              }
            }
          }
        }

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