Redocly / Redocly/redoc

200 Response with Binary Media Type (image/png) Not Rendered in Right Panel

Open
#2,701 1 comment 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

When defining a 200 response with a binary media type like image/png, ReDoc does not render the response tab in the right-hand panel. This creates an inconsistent documentation experience compared to JSON responses, especially when all other status codes (e.g., 401, 404, etc.) are shown clearly.

OpenAPI Snippet to Reproduce:

paths:
  /image/{id}:
    get:
      summary: Get image
      responses:
        '200':
          description: Image retrieved successfully
          content:
            image/png:
              schema:
                type: string
                format: binary
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

Expected Behavior:

The 200 response should appear in the right-hand panel with at least the description and content-type clearly shown.

Even if the content cannot be rendered (binary), a placeholder or notice would suffice.

Actual Behavior:

The 200 response is visible in the main content (middle panel), but nothing appears in the right-hand response panel unless a second content type (e.g., application/json) is added.

If a dummy content type is added, it triggers a content-type dropdown, which creates confusion for consumers of the documentation.

Workaround Attempted:

Adding a dummy application/json response alongside image/png to make the tab show.

Hiding the content-type dropdown via CSS as a UI patch.

However, this pollutes the OpenAPI spec and isn't ideal.

**

Image

**

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

Start by reproducing the OpenAPI snippet in ReDoc and compare the right-hand response panel with JSON and binary-only responses. Trace the response rendering path for a single image/png content type, then verify that the 200 response shows its description and content type without requiring a dummy media type or an unnecessary dropdown.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.