Skip to content

feat(cli): propagate collapsed config from API reference to child package nodes#16245

Open
cadesark wants to merge 1 commit into
mainfrom
devin/1780591032-propagate-collapsed-to-api-packages
Open

feat(cli): propagate collapsed config from API reference to child package nodes#16245
cadesark wants to merge 1 commit into
mainfrom
devin/1780591032-propagate-collapsed-to-api-packages

Conversation

@cadesark
Copy link
Copy Markdown
Contributor

@cadesark cadesark commented Jun 4, 2026

Description

Setting collapsed: open-by-default or collapsed: true on an - api entry in docs.yml now cascades to all auto-generated endpoint group sections (API package nodes) in the sidebar.

Previously, the collapsed value was only set on the top-level ApiReferenceNode but not propagated to child ApiPackageNodes — every child had collapsed: undefined hardcoded. The frontend already handles collapsed on any node via getInitiallyCollapsedNodes / getInitiallyOpenByDefaultNodes, so the only gap was the CLI not passing the value through.

Changes Made

  • In ApiReferenceNodeConverter.ts, changed 7 locations where apiPackage nodes had collapsed: undefined to inherit this.apiSection.collapsed
  • Explicit section entries in the layout that set their own collapsed are unchanged (line 464)
  • Added unreleased changelog entry

Testing

  • pnpm --filter @fern-api/docs-resolver test — 44/44 passed
  • pnpm --filter @fern-api/configuration-loader test -- --testPathPattern collapsible — 13/13 collapsed tests + 252 total passed
  • pnpm check — biome lint clean

Link to Devin session: https://app.devin.ai/sessions/f50b384f315b4bb8975f66c337f5fdb4
Requested by: @cade-fern

…kage nodes

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cadesark cadesark requested a review from amckinney as a code owner June 4, 2026 16:40
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Docs Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-06-04T05:35:26Z).

Fixture main PR Delta
docs 230.6s (n=5) 225.6s (35 versions) -5.0s (-2.2%)

Docs generation runs fern generate --docs --preview end-to-end against the benchmark fixture with 35 API versions (each version: markdown processing + OpenAPI-to-IR + FDR upload).
Delta is computed against the nightly baseline on main.
Baseline from nightly run(s) on main (latest: 2026-06-04T05:35:26Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-06-04 16:47 UTC

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Test Results: collapsed propagation to child apiPackage nodes

All 3 programmatic tests passed

Test Output
 ✓ collapsed-propagation.test.ts (3 tests) 860ms
   ✓ propagates collapsed: open-by-default to all child apiPackage nodes  580ms
   ✓ propagates collapsed: true to all child apiPackage nodes  154ms
   ✓ preserves default behavior when collapsed is undefined  123ms

 Test Files  1 passed (1)
      Tests  3 passed (3)
What was tested

Used the availability-inheritance fixture (Fern native definitions with multiple subpackages → multiple apiPackage child nodes) to verify:

  1. collapsed: "open-by-default" — set on apiSection, verified ALL child apiPackage nodes inherit it
  2. collapsed: true — same propagation for boolean value
  3. collapsed: undefined (default) — no regression, children remain undefined

All 8 apiPackage creation sites in ApiReferenceNodeConverter.ts now use this.apiSection.collapsed instead of undefined.

Visual context — current sidebar (before feature)

The live Natural docs site currently shows all 16 endpoint groups collapsed:

Current sidebar

With this PR + collapsed: open-by-default in docs.yml, all groups would start expanded showing individual endpoints.

Note: Could not generate a live docs preview (token lacks FDR access to natural org). The programmatic test directly verifies the navigation tree output, which is more rigorous than a visual check.

Devin session

@cadesark
Copy link
Copy Markdown
Contributor Author

cadesark commented Jun 4, 2026

Tested locally on demo site, API Ref page opens with all endpoint groups expanded after adding

collapsed: open-by-default under -api:

image

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Awesome — looks great! All 16 endpoint groups expanded by default, exactly as intended. Thanks for verifying on the live site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants