-
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 UI svg output showing the svg code as text instead of loading the image #5261
Comments
Hey @agilc! There's no way to do this currently, we display SVG data as-is: swagger-ui/src/core/components/response-body.jsx Lines 118 to 122 in 12e350f
There has been some discussion (#4018) and work (#4063) around this in the past, but we've never resolved it. |
You just need to make sure you set a correct content type header, then it will work: |
May I suggest the following: https://www.w3schools.com/graphics/tryit.asp?filename=trysvg_myfirst I had just pasted the swagger SVG XML there and it works! <svg width="100" height="100">
{{ content }}
</svg> |
There's an swagger-ui/src/core/components/response-body.jsx Lines 105 to 113 in 12e350f
Looks like it would need the |
I have an endpoint in Swagger UI. Its output should be an SVG image. But in the response, I'm getting the original SVG code instead of loading the image. How can I solve the issue?
I am using swagger UI NPM package(https://www.npmjs.com/package/swagger-ui) in my NodeJS App.
The text was updated successfully, but these errors were encountered: