-
Notifications
You must be signed in to change notification settings - Fork 8.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
String example breaks UI #2369
Comments
+1 |
This is the commit that seems to have caused the issue of "jsyaml is not defined": e4dc264 The js-yaml js file is still present in this repo, and re-adding it back to dist/index.html seems to fix this issue. I don't know if re-adding the js regresses #2221. As I don't know how to test that issue, I'm forgoing a PR at this time. FYI: Instead of the json reported earlier, we're using yaml and are having the same issue with a using a string value. Broken swagger: '2.0'
info:
title: Debug Yaml
version: '2369'
paths:
'/example':
get:
responses:
'200':
schema:
properties:
examples:
application/json: |
{} Working swagger: '2.0'
info:
title: Debug Yaml
version: '2369'
paths:
'/example':
get:
responses:
'200':
schema:
properties:
examples:
application/json: {} |
... mostly to see if it fixes matrix-org/matrix-spec-proposals#736 (it doesn't). This necessitates the addition of js-yaml to index.html to work around swagger-api/swagger-ui#2369. Also includes patches to make the sourcemaps in swagger-ui.js work right.
…es don't fail to render with cannot find jsyaml. Make it tolerant to parsing errors.
No longer an issue in 3.X. |
Consider this Swagger File:
Importing this into Swagger UI 2.2.2 breaks with "jsyaml is not defined". Change the examples.application/json value to an unquoted {}, and it will work. Looks like Swagger UI expects an object there, even though a string is valid JSON, too.
Putting JSON inside a string example is not intended by the spec (http://swagger.io/specification/#exampleObject) but I would not expect Swagger UI to break. Maybe a console warning is enough.
Thanks for your effort!
The text was updated successfully, but these errors were encountered: