Redocly / Redocly/redoc

Support for images like png/jpg to be displayed in examples

Open
#2,710 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

Describe the problem to be solved
I want to document an api which returns tiles for a map. The responses are all images for which i have examples, but redoc cannot display them in a pretty way. Currently it just base64-dumps the data.

Describe the solution you'd like
It would be nice if images like png and jpg could be displayed as viewable examples. directly in the Response samples section.

Describe alternatives you've considered
An alternative solution which would also work would be to provide a link in the Response samples section, rather than displaying the image/binary data.

Additional context
An example of how it's working/looking currently:

Image

(i use externalValue with a url and the correct headers exist when calling the url)

An example of how it could be looking
Image

the relevant part of the spec:

...
      responses:
        200:
          description: OK
          content:
            image/png:
              schema:
                type: string
                format: binary
              examples:
                image:
                  summary: String?
                  description: String?
                  externalValue: https://example.com/image.png
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start at the Response samples renderer and trace how an OpenAPI example using externalValue and an image/png or image/jpeg content type is handled. Done means image examples are viewable in the response section, or presented as links, instead of being base64-dumped; validate with the YAML example in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
documentation, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.