Skip to content

fix(theme): render branch descriptions for oneOf/anyOf and discriminator mappings - #1545

Merged
sserrata merged 3 commits into
PaloAltoNetworks:mainfrom
sserrata:fix/oneof-branch-description-1540
Jul 8, 2026
Merged

sserrata merged 3 commits into
PaloAltoNetworks:mainfrom
sserrata:fix/oneof-branch-description-1540

Conversation

@sserrata

@sserrata sserrata commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Restores the description render for each oneOf/anyOf branch and each discriminator.mapping target inside the Schema theme component.
  • Fix is hoisted once at the top of each TabItem in AnyOneOf so it covers every sub-branch (primitive, empty object, properties, allOf, oneOf, anyOf, items) rather than only the properties case.
  • Mirrors the existing MarkdownWrapper pattern already used by SchemaNodeDetails and by PropertyDiscriminator's top-level description.

Fixes #1540.

Root cause

  • AnyOneOf never read anyOneSchema.description.
  • PropertyDiscriminator rendered <SchemaNode schema={discriminator.mapping[key]} /> directly, and SchemaNode does not render schema.description itself — so mapping-target descriptions were silently dropped.

Test plan

  • Regenerate a demo page with a oneOf + discriminator.mapping where each branch has its own description; confirm the description text appears in each tab alongside the property list.
  • Regenerate a page with oneOf (no discriminator) branches carrying descriptions; confirm they render.
  • Verify no duplicate description rendering for nested allOf/oneOf branches inside a discriminator mapping.
  • yarn tsc --noEmit in packages/docusaurus-theme-openapi-docs (passes locally).

🤖 Generated with Claude Code

sserrata and others added 2 commits July 8, 2026 14:05
…tor mappings

Each oneOf/anyOf branch and each discriminator mapping target has its own
`description` in the source schema, but the Schema theme dropped it silently —
only the property list rendered per tab. Restore parity with SchemaNodeDetails
by rendering the branch's description via MarkdownWrapper at the top of each
TabItem.

In AnyOneOf the description is hoisted once per TabItem so it covers every
sub-branch (primitive, empty object, properties, allOf, oneOf, anyOf, items),
not just the properties path.

Fixes PaloAltoNetworks#1540

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Adds `description` to reusable variant schemas (TypeA/TypeB/NestedTypeA/
NestedTypeB/EmptyType/NestedVariantA/NestedVariantB) in discriminator.yaml
and to inline `oneOf` branches / UploadRequest components in oneOf.yaml.

Every existing path that references these schemas now exercises the
issue PaloAltoNetworks#1540 case (branch description must render at the top of each tab),
so regressions are caught by the demo without adding new endpoints.

Verified descriptions round-trip through the plugin into the generated
`*.StatusCodes.json` / `*.RequestSchema.json` under demo/docs/tests/.

Refs PaloAltoNetworks#1540

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@github-actions

github-actions Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 2053b32):

https://docusaurus-openapi-36b86--pr1545-ro7hup8h.web.app

(expires Wed, 15 Jul 2026 19:55:36 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

Drop the bold-name/em-dash convention and meta commentary about issue
PaloAltoNetworks#1540 in the fixture branch descriptions. They render on the demo site
as if they were real API documentation, so they should read like it.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@sserrata
sserrata merged commit 1311664 into PaloAltoNetworks:main Jul 8, 2026
11 checks passed
@sserrata sserrata mentioned this pull request Jul 8, 2026
sserrata added a commit that referenced this pull request Jul 10, 2026
…w/diff thumbnails

Currently the Visual Diff job runs, generates results.json + prod/preview/diff
PNGs + an HTML report, and uploads them as an artifact. To see whether a PR
regresses anything you have to open the Actions tab, download the artifact,
unzip it, and click through the HTML report — easy to skip during review, which
is what let the property-duplication regression in #1545 through.

This wires up:

- A second Firebase Hosting channel (`pr<N>-diffs`) per PR that hosts the
  visual_diffs/ directory (prod/preview/diff PNGs). Reuses the existing
  Hosting site + WIF auth, expires on the same 7d clock as the preview
  channel, ~few MB per PR. `entryPoint: visual_diffs` points the action at
  a scratch firebase.json + .firebaserc we write into that directory at
  job time so the site's real firebase.json is untouched.

- scripts/build-visual-diff-comment.ts turns results.json into a Markdown
  body: summary counts table, then a <details> block listing each mismatched
  page with a <table> row of prod/preview/diff thumbnails (linked to full-size
  images on the diffs channel). Clean runs render a "no regressions" body so
  the sticky comment can overwrite a stale prior report. Skipped pages
  collapse into a secondary block. Long reports truncate to 25 diffs / 50
  skips with a link back to the artifact HTML.

- A github-script step finds any existing comment carrying the
  `<!-- visual-diff-report -->` marker and updates it in place, so the PR's
  comment thread doesn't accumulate one report per push. Uses the built-in
  GITHUB_TOKEN — no PAT or third-party action needed. Requires
  `pull-requests: write` on the visual_diff job; `id-token: write` is added
  for the WIF auth used by the diffs channel deploy.

This branch was previously deployed

1 inactive deployment
preview — 2053b32b Deployed Jul 8, 2026 by sserrata via Deploy #2260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A description from "oneOf: $ref: schemas" is not rendered

1 participant