Repository navigation
Let API union variants fold their fields behind a toggle - #4491
Merged
Merged
Conversation
Variants behind chips showed their fields with no way to collapse them, while object rows fold. The fields still start expanded; a "hide properties" toggle now shortens the view. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Variants of a
oneOf/anyOfbehind chips now have a "hide properties" toggle, the same one object rows use, so a reader can shorten the view.Affects:
API referencePrompt summary: Fix elastic/docs-eng-team#1074. Objects fold their fields but
oneOf/anyOfblocks do not, and nothing says how to collapse them. Add a way to collapse them and keep the default as it is.Why
Two or more variants show behind chips, and the picked variant lists its fields at once. Those fields have no toggle, so a long variant cannot be folded. Object rows next to it fold with "hide properties".
What
Toggle on chip variants
A variant behind chips renders the same "hide properties" toggle as a lone variant or an object row. The existing disclosure script handles the click, and links or find-in-page into a folded variant still open it.
Default stays expanded
The variant starts expanded, as before: picking a chip is the choice to read that variant. Only the control to fold it is new.
Verify
Check on the preview
typevariants and click "hide properties" under a chip; the fields fold and "show properties" brings them back.