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

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

Closed
hexmind opened this issue Jan 8, 2024 · 4 comments
Closed

Comments

@hexmind
Copy link

hexmind commented Jan 8, 2024

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"
                }
              }
            }
          }
        }

hexmind pushed a commit to hexmind/springdoc-openapi that referenced this issue Jan 8, 2024
@hexmind
Copy link
Author

hexmind commented Feb 25, 2024

?

@bnasslahsen
Copy link
Contributor

@hexmind,

your PR is in draft mode. have completed your PR ?

@hexmind
Copy link
Author

hexmind commented Feb 25, 2024

Hi, my intention of this PR was to show a problem and a behavior only.

@bnasslahsen
Copy link
Contributor

@hexmind,

ok, will take it in consideration for further investigations.

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