Redocly / Redocly/redoc

Can I change the condition for displaying the "Example Dropdown" in the "Response Sample" section to when there is more than one example?

Open
#2,675 1 comment 0 reactions 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
The 'Example Dropdown' does not appear when there is only one example, which is very inconvenient. Currently, the condition is set to display only when there are more than one example. Would it be okay to change this to display when there is at least one example? I found the relevant code in MediaTypeSample.tsx.

Describe the solution you'd like
Modify the condition in MediaTypeSample.tsx.

Describe alternatives you've considered
Nothing

Additional context

  • AS_IS
    Image

  • TO_BE
    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 in MediaTypeSample.tsx and inspect the condition controlling whether the Example Dropdown is rendered in the Response Sample section. Change the condition to cover the stated single-example case, then verify the dropdown behavior for one example and for multiple examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation, frontend
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.