-
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
Swagger replaces quotes with angled quotes in documentation #5060
Comments
Try using Markdown formatting instead of HTML tags. In Markdown, you can make code blocks by indenting the lines by four spaces or wrapping them in triple backticks JSON version:
YAML version (to illustrate the original formatting): info:
description: >-
Example of a simple request via curl:
curl -X POST "https://api.foobar.com/stuff" -H "Accept: application/json" -H "Content-Type: application/json" -d ''{}''
# or
info:
description: >-
Example of a simple request via curl:
```
curl -X POST "https://api.foobar.com/stuff" -H "Accept: application/json" -H "Content-Type: application/json" -d ''{}''
``` |
Hi @veqryn, I'm not able to reproduce this. Using this string as an input to Swagger UI:
in Chrome 70, all quotation-like marks that Swagger UI renders into the Info section are either U+0022 quotation marks or U+0027 apostrophes, according to this Unicode character identifier. Perhaps this is a browser bug? (You didn't fill out the information section of the template, so I don't know what you're using). |
PS: you don't need to use escape codes to write HTML in your description, this will work fine: info:
description: '<p>Example of a simple request via curl:</p><pre>curl -X POST "https://api.foobar.com/stuff" -H "Accept: application/json" -H "Content-Type: application/json" -d ''{}''</pre>'
But, as @hkosova mentioned, taking advantage of Markdown's readability is even better. |
@shockey Here is an easy reproducer:
{
"swagger": "2.0",
"info": {
"title": "Foobar Service",
"description": "\u003cbr\u003e\u003cp\u003eExample of a simple GET request via curl with bearer HTTP Authentication:\u003c/p\u003e\u003cpre\u003ecurl -X GET \"https://foobar.com/stuff\" -H \"Accept: application/json\" -H \"Authorization: Bearer abc123.xyz.789\"\u003c/pre\u003e",
"version": "2.0"
},
"paths": {}
} I see the quotes replaced every time I do this. Please let me know if you do not. |
Confirmed. To be clear: the definition itself still has regular quotation marks, but the rendered content uses smart quotes. |
Fixed! Thanks for the help @veqryn 👍 |
Thank you! |
In our documentation we have example curl calls and other things using single
'
and double"
quotes.For whatever reason, when Swagger pulls in this documentation it insists on replacing the quotes with single
‘’
and double“”
angled quotes.Here is an example of what it looks like:
This is a bug because when our users copy and paste these commands into their shell, they don't work because of the angled quotes.
We are using swagger docker image:
swaggerapi/swagger-ui:v3.19.3
And it is the
API_URLS
environment variable to pull the swagger json from another url.The contents of the swagger json start with:
The text was updated successfully, but these errors were encountered: