Forum Discussion

tomkcook's avatar
New Contributor
3 years ago

Is there a way to embed an image URL in the spec so that it displays the image in Swagger-UI?

What it says on the tin, really.  I've got a diagram that I want to include in the swagger documentation.  What do I put in the spec so that swagger-ui will display the image?  I've tried GFM-style image linking and a plain <img> tag.

2 Replies

    • tomkcook's avatar
      New Contributor

      Thanks.  Tracked this down to two separate issues in the end:


      1. My GFM was incorrect - using square brackets instead of parentheses for the URL.
      2. I'm using flask_swagger to generate the OpenAPI.  Because this scans docstrings, it's usual to have extra indentation at the beginning of each line.  In certain cases, flask_swagger doesn't strip this out and so my image link was being treated as preformatted text.