You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not totally sure if this is a bug or a feature request, but I think the behaviour is in conflict with the OpenAPI Specification so I have labelled it as a bug. I hope you'll correct me if I'm wrong.
I would like to be able to document an API endpoint which responds with text/csv format by providing an example response. Currently it is possible to specify an example of a media type on an API response object (OpenAPI spec), however this is not rendered in the Swagger UI. The description of the property in the specification implies that this example should have precedence over any others, so I would expect it to be visible whether there is an example specified for the response schema or not.
The specification says:
Example of the media type. The example object SHOULD be in the correct format as specified by the media type. The example field is mutually exclusive of the examples field. Furthermore, if referencing a schema which contains an example, the example value SHALL override the example provided by the schema.
As a workaround I have tried associating the example with the response schema, which does appear on the UI. However this isn't an adequate solution for my particular case. When the example property is given in this way, new lines are rendered as \n, and the text is enclosed in quotes. This is inappropriate for specifying examples in CSV format.
Q
A
Bug or feature request?
Bug
Which Swagger/OpenAPI version?
3.0.1
Which Swagger-UI version?
3.13.6
How did you install Swagger-UI?
Using maven: org.webjars.swagger-ui.3.13.6
Which browser & version?
Chrome 65.0.3325.181
Which operating system?
Mac OS High Sierra 10.13.4
openapi: 3.0.1info:
title: Demo Appdescription: | Swagger UI response exampleversion: '0.1'paths:
/example:
description: Exampleget:
description: Example GETresponses:
'200':
description: Successcontent:
text/csv:
schema:
type: objectproperties:
items:
type: arrayitems:
type: objectproperties:
label:
type: stringtype:
type: stringexample: |- type, label type A, name Aexample: |- type, label type B, name B
This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.
If you think you're experiencing something similar to what you've found here: please open a new issue, follow the template, and reference this issue in your report.
I'm not totally sure if this is a bug or a feature request, but I think the behaviour is in conflict with the OpenAPI Specification so I have labelled it as a bug. I hope you'll correct me if I'm wrong.
I would like to be able to document an API endpoint which responds with
text/csv
format by providing an example response. Currently it is possible to specify anexample
of a media type on an API response object (OpenAPI spec), however this is not rendered in the Swagger UI. The description of the property in the specification implies that this example should have precedence over any others, so I would expect it to be visible whether there is an example specified for the response schema or not.The specification says:
As a workaround I have tried associating the example with the response schema, which does appear on the UI. However this isn't an adequate solution for my particular case. When the
example
property is given in this way, new lines are rendered as\n
, and the text is enclosed in quotes. This is inappropriate for specifying examples in CSV format.Replicated on Swagger Editor (https://editor.swagger.io/)
Expected Behavior
Current Behavior
\n
The text was updated successfully, but these errors were encountered: