Redocly / Redocly/redoc

Add option to automatically expand schemas in SchemaDefinition to a certain level

Open
#1,692 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I use <SchemaDefinition> to render my schemas. All my schemas are enveloped so that when the page is loaded, unfortunately nothing useful is shown, and it is not possible to use the browser's Find-In-Page to search for useful properties. All the interesting stuff is "one level down".

I currently work around this by executing the following in the Redoc.init callback:

var els = document.querySelectorAll('td button');
for (el of els) {
  el.click();
}
// Needed because expansion shifts the browser view
setTimeout(function () { window.location.hash = window.location.hash; })

This is, of course, just a hack and not in any way optimal.

It would be nice if ReDoc supported automatically expanding SchemaDefinition nodes to a certain level.

Note that #1693 would solve this fairly elegantly.

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 at the SchemaDefinition component and its expansion controls, then compare the requested behavior with the approach mentioned in #1693. Done means ReDoc exposes a configurable expansion depth so enveloped schemas show useful nested properties on initial load without the DOM-click workaround.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.