Bump docusaurus-openapi-docs plugin and theme to 5.1.2#1342
Merged
Conversation
Upgrades docusaurus-plugin-openapi-docs and docusaurus-theme-openapi-docs from 5.0.2 to 5.1.1. No breaking changes; peer deps still target @docusaurus/* ^3.10.0 (we're on 3.10.1). Notable fixes/features between 5.0.2 and 5.1.1: - Configurable schema expansion level (themeConfig.api.schemaExpansion) - Render branch descriptions for oneOf/anyOf and discriminator mappings - Hoist schema normalization out of the render path (perf) - Rank Postman path matchers by per-segment specificity - Prefill "Send API Request" from example fields - Preserve large-integer precision in the response panel - Render nested arrays as Type[][] in the Schema tab - Vendor theme-common/internal usages ahead of Docusaurus v4
|
Visit the preview URL for this PR (updated for commit c0a444f): https://pan-dev-f1b58--pr1342-8sh0o4fo.web.app (expires Fri, 17 Jul 2026 19:50:13 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 9359a9fa100d5fdb082f75280473a90b1f96eb51 |
The swizzled Request/index.js was crashing on 5.1.1 with "Cannot read properties of undefined (reading 'REQUEST_TITLE')" because 5.1.0 removed the shared translationIds dictionary (OPENAPI_REQUEST.*) and inlined the ids at each translate() call site so `docusaurus write-translations` can extract them via static analysis. The swizzled copy still imported the removed constants. The only intentional customization in the swizzle was bumping the fetch timeout from 10s to 30s (see 638721a). Upstream 5.1.x now sets DEFAULT_REQUEST_TIMEOUT = 30000 out of the box and exposes `themeConfig.api.requestTimeout` for further overrides, so the swizzle is redundant. Dropping it also picks up upstream improvements: - write-translations-extractable i18n strings - categorized timeout / network / cors error messages - request body encoding support (multipart, urlencoded) - frontmatter proxy precedence over themeConfig proxy - accessible server label via useId() - semantic <button> for expand/collapse (was <span>) - Send button visibility when a proxy is configured
Opts into the 5.1.0 themeConfig.api.schemaExpansion feature so the depth picker (0..4 / all) appears in the RequestSchema panel. Off by default upstream (config.enabled defaults to false). Defaults chosen: - default: 0 — collapsed on load; matches prior behavior - max: 4 — matches upstream default - persist: true — remember the reader's last pick in localStorage
3 tasks
Temporarily point at the 0.0.0-1337 canary so this PR's preview build exercises the property-duplication fix from docusaurus-openapi-docs PR #1549 end-to-end. Revert to a real 5.1.x tag before merge.
Swaps the 0.0.0-1337 canary for the tagged 5.1.2 patch, which contains the
fix for the property-duplication regression seen on request schemas with
`type: object` + outer `properties` + `anyOf: [{oneOf: [...]}, ...]`
(docusaurus-openapi-docs PR #1549).
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.
Summary
docusaurus-plugin-openapi-docsanddocusaurus-theme-openapi-docsfrom 5.0.2 → 5.1.2.@docusaurus/* ^3.10.0;docusaurus-plugin-sassis already resolved to 0.2.6 in the lockfile, satisfying the theme's^0.2.3peer.ApiExplorer/Requestswizzle and opts into the newthemeConfig.api.schemaExpansiondepth control — details below.Why 5.1.2 and not 5.1.1
5.1.1 shipped a regression that duplicated outer object properties on request schemas shaped as
{properties, anyOf: [{oneOf: [...]}, ...]}— first observed onPOST /ethernet-interfaces, wherename,default_value,link_speed, etc. rendered once at the outer object tab and again inside eachaggregate_group/tap/layer2/layer3variant tab. 5.1.2 ships the fix from PaloAltoNetworks/docusaurus-openapi-docs#1549. This PR was validated against the0.0.0-1337canary before the 5.1.2 tag went out.Why the Request swizzle had to go
The initial bump to 5.1.1 broke every API page with:
The 5.1.0 change
fix(theme): make i18n strings extractable by write-translationsdeleted the sharedtranslationIdsdictionary (OPENAPI_REQUEST.*, etc.) and inlined the ids at eachtranslate()call site so Docusaurus' Babel-based extractor can pick them up. The pan.dev swizzledsrc/theme/ApiExplorer/Request/index.jsstill importedOPENAPI_REQUESTfrom@theme/translationIds— now an empty module — soOPENAPI_REQUEST.REQUEST_TITLEthrew at render time.The swizzle's only intentional customization (per
638721afa) was bumping the fetch timeout from 10s to 30s inmakeRequest.js. Upstream 5.1.x now setsDEFAULT_REQUEST_TIMEOUT = 30000out of the box and exposesthemeConfig.api.requestTimeoutfor further overrides — so the swizzle is entirely redundant. Dropping it also picks up:themeConfig.api.proxyuseId()<button>for expand/collapse (was<span>)Schema expansion depth
Also opts into the new 5.1.0
themeConfig.api.schemaExpansionfeature (off by default upstream) so the depth picker (0…4 / all) appears on the request-body Schema tab:Notable changes between 5.0.2 and 5.1.2
5.1.2 (patch)
fix(theme): stop duplicating branch properties in nested anyOf/oneOf renders(#1549)5.1.1 (patch)
fix(plugin): rank Postman path matchers by per-segment specificityfix(theme): render branch descriptions foroneOf/anyOfand discriminator mappingsfix(theme): hoist schema normalization out of the render path (perf)5.1.0 (minor — highlights)
feat(theme): configurable schema expansion level (themeConfig.api.schemaExpansion)fix(theme): make i18n strings extractable bywrite-translationsfix(theme): vendortheme-common/internalusages ahead of Docusaurus v4fix(theme): prefill "Send API Request" from example fieldsfix(plugin): render OpenAPI 3.1 type unions in schema namesfix(theme): preserve large-integer precision in response panelfix: render nested arrays asType[][]in the Schema tabfix: dedupe properties whenallOfoverride redefines nested array itemsRelease notes: v5.1.2, v5.1.1, v5.1.0
Test plan
REQUEST_TITLEruntime error (repro was/prisma-airs/api/airuntimesecurity/management/create-new-api-key/)POST /ethernet-interfaces(/scm/api/config/sase/network configurations/create-ethernet-interfaces/) renders base properties once per variant tab, not twice🤖 Generated with Claude Code