5

Is it possible to render inline images as part of description texts etc in openapi3.0/swagger? When looking at the spec, all I can find is the ability to link to images in request examples, specifically. What I want is to be able to include diagrams etc in introductory texts of my API, similar to markdown etc. Example:

openapi: 3.0.2
info:
  version: "1.0.0"
  title: "My API"
  description: "This API bla bla bla [block diagram] bla bla [another inline image]"

Is anything like this at all possible?

JHH
  • 8,567
  • 8
  • 47
  • 91
  • 1
    Related (or duplicate): [How to format OpenAPI/Swagger text descriptions?](https://stackoverflow.com/q/39924144/113116) – Helen Aug 29 '19 at 10:55

1 Answers1

4

At least with the ReDoc renderer, it seems possible to use HTML straight into your description texts, so adding <img src="./image.png" /> appears to work:

openapi: 3.0.2
info:
  version: "1.0.0"
  title: "My API"
  description: "This API bla bla bla <img src="./block-diagram.png" /> bla bla <img src="./another-inline-image.png" />

I don't know if there's a better way or if there are limitations to this approach such as cross-origin issues.

JHH
  • 8,567
  • 8
  • 47
  • 91