-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Regression: OAS2 response examples are not displayed if response has no schema #6631
Comments
@hkosova I am unable to reproduce the issue as described with the provided definition. When loaded into editor.swagger.io, both endpoints display
However, I do observe an issue of updating. If the example in |
@tim-lai you're right, it must have happened during editor updates. Is this a UI issue or editor issue then? Steps to reproduce:
swagger: "2.0"
info:
title: OAS2 response examples
version: 1.0.0
produces:
- application/json
paths:
/foo1:
get:
summary: Response without a schema
responses:
200:
description: Successful response
/foo2:
get:
summary: Response with schema
responses:
200:
description: Successful response
schema: {}
examples:
application/json:
foo: custom value
Expected result: First operation should display newly added response example. Actual result: Newly added example is not displayed. |
Pretty sure this is a swagger-ui issue. |
Yup, it's swagger-ui. I can see that the Line 570 in 24225e4
|
Issue #5458 reappeared in v. 3.36.2.
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Describe the bug you're encountering
v. 3.36.2 has a regression where OAS2 response
examples
are not displayed if the response does not have aschema
defined. Previous versions of Swagger UI rendered the response examples in this case.Expected behavior
Both
GET /foo1
andGET /foo2
should display the same response example:Actual behavior
GET /foo1
does NOT display a response example. But if you addschema: {}
to its /foo1's response then the example appears.Workaround
Add a
schema
for responses that have examples. Even an empty schemaschema: {}
will work.The text was updated successfully, but these errors were encountered: