Skip to content

fix(plugin): restore menu__list-item--deprecated class on sidebar items - #1474

Merged
sserrata merged 1 commit into
mainfrom
fix/deprecated-sidebar-class-1417
May 19, 2026
Merged

sserrata merged 1 commit into
mainfrom
fix/deprecated-sidebar-class-1417

Conversation

@sserrata

Copy link
Copy Markdown
Member

Summary

  • Adds menu__list-item--deprecated to the MDX front matter's sidebar_class_name template when an operation is deprecated: true
  • Restores the strikethrough styling on deprecated sidebar items that broke in v5.0.0

Why

The sidebar generator (packages/docusaurus-plugin-openapi-docs/src/sidebars/index.ts:55) already attaches menu__list-item--deprecated to deprecated items via clsx. That continues to work — but starting with @docusaurus/[email protected] (bundled into v5.0.0), Docusaurus changed sidebar-item resolution from:

className: item.className,

to:

className: frontMatter.sidebar_class_name ?? item.className,

Our MDX template emitted only "{{{api.method}}} api-method" for sidebar_class_name, so the front matter value clobbered the sidebar generator's className and the deprecated class never reached the DOM. The same edit is applied to the demo's custom mustache template that drives the petstore config.

Test plan

  • Regenerate petstore, petstore31, and tests API docs and verify front matter:
    • deprecated op → sidebar_class_name: "get api-method menu__list-item--deprecated"
    • non-deprecated op → sidebar_class_name: "get api-method" (unchanged)
  • Confirm rendered <li> carries menu__list-item--deprecated in the built sidebar JSON
  • Reviewer: load the demo locally and confirm the strikethrough returns on /petstore31/find-pets-by-tags

Closes #1417

🤖 Generated with Claude Code

The MDX front matter template emitted `sidebar_class_name` without the
deprecated modifier. Under Docusaurus 3.10+ (bundled with v5.0.0), front
matter takes precedence over sidebar item className, clobbering the
deprecated class set by the sidebar generator. Conditionally append the
class in the template so it survives the precedence change.

Closes #1417

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

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 2.32 MB

ℹ️ View Unchanged
Filename Size Change
demo/.docusaurus/codeTranslations.json 2 B 0 B
demo/.docusaurus/docusaurus.config.mjs 16.4 kB 0 B
demo/.docusaurus/globalData.json 76.2 kB 0 B
demo/.docusaurus/i18n.json 372 B 0 B
demo/.docusaurus/registry.js 110 kB 0 B
demo/.docusaurus/routes.js 104 kB 0 B
demo/.docusaurus/routesChunkNames.json 43.3 kB 0 B
demo/.docusaurus/site-metadata.json 1.58 kB 0 B
demo/build/assets/css/styles.********.css 173 kB 0 B
demo/build/assets/js/main.********.js 682 kB 0 B
demo/build/assets/js/runtime~main.********.js 25.1 kB 0 B
demo/build/index.html 99.5 kB 0 B
demo/build/petstore/add-pet/index.html 30 kB +28 B (+0.09%)
demo/build/petstore/create-user/index.html 24.7 kB 0 B
demo/build/petstore/create-users-with-array-input/index.html 24.8 kB 0 B
demo/build/petstore/create-users-with-list-input/index.html 24.8 kB 0 B
demo/build/petstore/delete-order/index.html 24.5 kB 0 B
demo/build/petstore/delete-pet/index.html 24.8 kB +28 B (+0.11%)
demo/build/petstore/delete-user/index.html 25 kB 0 B
demo/build/petstore/find-pets-by-status/index.html 25.5 kB +28 B (+0.11%)
demo/build/petstore/find-pets-by-tags/index.html 26.2 kB +28 B (+0.11%)
demo/build/petstore/get-inventory/index.html 23.8 kB 0 B
demo/build/petstore/get-order-by-id/index.html 24.8 kB 0 B
demo/build/petstore/get-pet-by-id/index.html 25.6 kB +28 B (+0.11%)
demo/build/petstore/get-user-by-name/index.html 25.1 kB 0 B
demo/build/petstore/login-user/index.html 25.6 kB 0 B
demo/build/petstore/logout-user/index.html 24.4 kB 0 B
demo/build/petstore/new-pet/index.html 25 kB +28 B (+0.11%)
demo/build/petstore/pet/index.html 23.2 kB +28 B (+0.12%)
demo/build/petstore/place-order/index.html 24 kB 0 B
demo/build/petstore/schemas/apiresponse/index.html 25.2 kB 0 B
demo/build/petstore/schemas/cat/index.html 39.1 kB +28 B (+0.07%)
demo/build/petstore/schemas/category/index.html 26.3 kB 0 B
demo/build/petstore/schemas/dog/index.html 39.3 kB 0 B
demo/build/petstore/schemas/honeybee/index.html 39.3 kB 0 B
demo/build/petstore/schemas/id/index.html 23.4 kB 0 B
demo/build/petstore/schemas/order/index.html 27.3 kB 0 B
demo/build/petstore/schemas/pet/index.html 38.8 kB 0 B
demo/build/petstore/schemas/tag/index.html 24.7 kB 0 B
demo/build/petstore/schemas/user/index.html 40.7 kB 0 B
demo/build/petstore/store/index.html 22.2 kB 0 B
demo/build/petstore/subscribe-to-the-store-events/index.html 30.9 kB 0 B
demo/build/petstore/swagger-petstore-yaml/index.html 30.9 kB 0 B
demo/build/petstore/update-pet-with-form/index.html 25 kB +28 B (+0.11%)
demo/build/petstore/update-pet/index.html 25.4 kB +28 B (+0.11%)
demo/build/petstore/update-user/index.html 25 kB 0 B
demo/build/petstore/upload-file/index.html 24.8 kB +28 B (+0.11%)
demo/build/petstore/user/index.html 22.9 kB 0 B

compressed-size-action

@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 0cac304):

https://docusaurus-openapi-36b86--pr1474-1dmfswsi.web.app

(expires Tue, 26 May 2026 14:10:48 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata
sserrata merged commit 72f1187 into main May 19, 2026
12 checks passed
@sserrata
sserrata deleted the fix/deprecated-sidebar-class-1417 branch May 19, 2026 14:30

This branch was previously deployed

1 inactive deployment
preview — 0cac304c Deployed May 19, 2026 by sserrata via Deploy #2155
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.

Deprecated endpoint do not have the --deprecated css class anymore

1 participant