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

Multiple response examples not supported #371

Closed
GCGarrettG opened this issue Nov 10, 2017 · 7 comments
Closed

Multiple response examples not supported #371

GCGarrettG opened this issue Nov 10, 2017 · 7 comments

Comments

@GCGarrettG
Copy link

The examples key can only be used to specify a single example response. If more than one example is provided only the first is displayed.

  "/myCar":
    get:
      operationId: CAR
      produces:
      - application/json
      - text/plain
      responses:
        '200':
          description: OK
          examples:
            application/json:
              car: 'blue'
            text/plain: 'TextAboutMyCar'
          schema:
            "$ref": "#/def/cars"
      security: []
      parameters: []```


@mpasaric
Copy link

mpasaric commented Nov 10, 2017

Isn't multiple response examples only supported by OpenAPI 3.0? For which ReDoc support is still in development?

EDIT: sorry, didn't notice they were for different MIME types. Yeah, this is supposed to work...

@RomanHotsiy
Copy link
Member

@mpasaric I believe @GCGarrettG is talking about examples for application/json and text/plain.

This is an issue and I can reproduce it. Will try to fix asap and publish new patch release

@RomanHotsiy
Copy link
Member

@GCGarrettG I've fixed the issue and will release new version soon.
Unfortunately, ReDoc supports only json, xml and text-like samples.

ReDoc 2.0 will support all the mime samples correctly so I am not going to fix it properly for ReDoc 1.x

Thanks for the bug report!

@GCGarrettG
Copy link
Author

@RomanGotsiy My pleasure. Thanks for the expedient fix, I look forward to the next release!

@zucher
Copy link

zucher commented Nov 17, 2017

@RomanGotsiy, you can also take my fork, on my we want to returns csv text format, not only text/plain.
An other point not already treated is the returns format: If the REST request doesn't return application/json, we don't have to display the JSON associated tab.

@rishagit
Copy link

rishagit commented Sep 8, 2021

text-

hi
i am working on the latest version of redoc and for me examples are ignored if type is plain/text. Any way to show example for plain/text type as well?

@edno
Copy link

edno commented Dec 2, 2021

I can see that Redoc still ignore object response examples when content-type is not application-json. However, this is compliant with OAS, and correctly supported by other doc generators.

Example with Swagger editor:
Screenshot 2021-12-02 at 13 43 17

@RomanHotsiy - Do you have an update on

ReDoc 2.0 will support all the mime samples correctly so I am not going to fix it properly for ReDoc 1.x

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

6 participants