Skip to content

feat(plugin): support OpenAPI 3.2 hierarchical tags (tags[].parent) - #1603

Merged
sserrata merged 3 commits into
mainfrom
feat/openapi-32-tag-parent
Aug 11, 2026
Merged

sserrata merged 3 commits into
mainfrom
feat/openapi-32-tag-parent

Conversation

@sserrata

Copy link
Copy Markdown
Member

Summary

Adds a new groupPathsBy: "tagParent" sidebar mode that builds nested sidebar categories from the OpenAPI 3.2 standardized tags[].parent field — an alternative to the vendor x-tagGroups extension that supports arbitrary depth.

Closes #1588.

Config

sidebarOptions: {
  groupPathsBy: "tagParent",
}

Given:

openapi: 3.2.0
tags:
  - name: Products
  - name: Cakes
    parent: Products
  - name: Seasonal Cakes
    parent: Cakes

produces:

Products
└── Cakes
    ├── GET /cakes
    └── Seasonal Cakes
        └── GET /cakes/seasonal

Changes

  • TagObject: add parent, summary, kind (OpenAPI 3.2 tag fields).
  • options.ts: allow "tagParent" in the groupPathsBy Joi validation.
  • sidebars/index.ts: new nestByTagParents() builder reusing the existing flat groupByTags output, plus a tagParent branch in generateSidebarSlice.
  • Demo: new examples/food/bakery/openapi.yaml (3.2 spec) + bakery plugin instance + "Bakery" sidebar entry.
  • Docs: new "Grouping by Tag Parent" section in demo/docs/sidebars.mdx; groupPathsBy row updated in both READMEs.

Behavior / edge cases

  • Container tags (a parent with no operations of its own, e.g. Products) still render, provided they have descendants with content.
  • Empty tags (no operations, no children) are pruned.
  • Dangling parent (references an undeclared tag) → treated as top-level.
  • Cyclic parent (A → B → A, or self-parent) → detected; affected tags render as top-level instead of recursing.
  • x-tagGroups/tag behavior is unchanged.

Testing

  • 4 new unit tests (nesting, empty-container pruning, cycle guard, dangling-parent guard); all plugin tests pass.
  • TypeScript type-check clean.
  • Verified against the demo: gen-api-docs bakery produces the correct nested sidebar.ts and the routes serve.

🤖 Generated with Claude Code

Add a `groupPathsBy: "tagParent"` sidebar mode that nests tag categories
into an arbitrary-depth hierarchy driven by the standardized OpenAPI 3.2
`tags[].parent` field, instead of the vendor `x-tagGroups` extension.

- Add `parent`, `summary`, and `kind` to `TagObject`
- Allow "tagParent" in the `groupPathsBy` Joi validation
- Nest categories from `tags[].parent`, rendering pure-container parents,
  pruning empty tags, and guarding against dangling and cyclic references
- Add a bakery demo spec + config and document the new mode

Closes #1588

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

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Size Change: +22.2 kB (+0.92%)

Total Size: 2.42 MB

📦 View Changed
Filename Size Change
demo/.docusaurus/docusaurus.config.mjs 16.6 kB +229 B (+1.4%)
demo/.docusaurus/globalData.json 83.8 kB +823 B (+0.99%)
demo/.docusaurus/registry.js 121 kB +1.27 kB (+1.06%)
demo/.docusaurus/routes.js 115 kB +1.15 kB (+1.01%)
demo/.docusaurus/routesChunkNames.json 47.7 kB +471 B (+1%)
demo/build/assets/js/main.********.js 702 kB +2.22 kB (+0.32%)
demo/build/assets/js/runtime~main.********.js 27.3 kB +245 B (+0.9%)
demo/build/index.html 99.5 kB +83 B (+0.08%)
demo/build/petstore/add-pet/index.html 30 kB +435 B (+1.47%)
demo/build/petstore/create-user/index.html 24.6 kB +435 B (+1.8%)
demo/build/petstore/create-users-with-array-input/index.html 24.7 kB +435 B (+1.79%)
demo/build/petstore/create-users-with-list-input/index.html 24.7 kB +435 B (+1.79%)
demo/build/petstore/delete-order/index.html 24.6 kB +435 B (+1.8%)
demo/build/petstore/delete-pet/index.html 24.8 kB +435 B (+1.79%)
demo/build/petstore/delete-user/index.html 24.9 kB +435 B (+1.77%)
demo/build/petstore/find-pets-by-status/index.html 25.4 kB +435 B (+1.74%)
demo/build/petstore/find-pets-by-tags/index.html 26.1 kB +435 B (+1.69%)
demo/build/petstore/get-inventory/index.html 23.9 kB +435 B (+1.86%)
demo/build/petstore/get-order-by-id/index.html 24.8 kB +435 B (+1.79%)
demo/build/petstore/get-pet-by-id/index.html 25.5 kB +435 B (+1.73%)
demo/build/petstore/get-user-by-name/index.html 25 kB +435 B (+1.77%)
demo/build/petstore/login-user/index.html 25.6 kB +435 B (+1.73%)
demo/build/petstore/logout-user/index.html 24.3 kB +435 B (+1.82%)
demo/build/petstore/new-pet/index.html 24.9 kB +435 B (+1.78%)
demo/build/petstore/pet/index.html 23.2 kB +435 B (+1.91%)
demo/build/petstore/place-order/index.html 24.1 kB +435 B (+1.84%)
demo/build/petstore/schemas/apiresponse/index.html 25.3 kB +435 B (+1.75%)
demo/build/petstore/schemas/cat/index.html 39.3 kB +435 B (+1.12%)
demo/build/petstore/schemas/category/index.html 26.4 kB +435 B (+1.68%)
demo/build/petstore/schemas/dog/index.html 39.7 kB +435 B (+1.11%)
demo/build/petstore/schemas/honeybee/index.html 39.7 kB +435 B (+1.11%)
demo/build/petstore/schemas/id/index.html 23.5 kB +435 B (+1.89%)
demo/build/petstore/schemas/order/index.html 27.5 kB +435 B (+1.61%)
demo/build/petstore/schemas/pet/index.html 39.3 kB +435 B (+1.12%)
demo/build/petstore/schemas/tag/index.html 24.8 kB +435 B (+1.78%)
demo/build/petstore/schemas/user/index.html 41.2 kB +435 B (+1.07%)
demo/build/petstore/store/index.html 22.2 kB +435 B (+2%)
demo/build/petstore/subscribe-to-the-store-events/index.html 30.9 kB +435 B (+1.43%)
demo/build/petstore/swagger-petstore-yaml/index.html 31.1 kB +435 B (+1.42%)
demo/build/petstore/update-pet-with-form/index.html 24.9 kB +435 B (+1.78%)
demo/build/petstore/update-pet/index.html 25.4 kB +435 B (+1.75%)
demo/build/petstore/update-user/index.html 24.9 kB +435 B (+1.78%)
demo/build/petstore/upload-file/index.html 24.8 kB +435 B (+1.79%)
demo/build/petstore/user/index.html 22.8 kB +435 B (+1.94%)
ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/i18n.json 372 B
demo/.docusaurus/site-metadata.json 1.58 kB
demo/build/assets/css/styles.********.css 218 kB

compressed-size-action

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

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

https://docusaurus-openapi-36b86--pr1603-089i7qy5.web.app

(expires Tue, 18 Aug 2026 16:16:19 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Wire the bakery demo through the plugin-generated sidebar instead of an
autogenerated (filesystem) sidebar, which flattened the hierarchy. Also
drop explanatory code comments.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@sserrata
sserrata merged commit 7950480 into main Aug 11, 2026
12 checks passed
@sserrata
sserrata deleted the feat/openapi-32-tag-parent branch August 11, 2026 16:33
@sserrata sserrata mentioned this pull request Aug 11, 2026
4 tasks done

This branch was previously deployed

1 inactive deployment
preview — a50d63d8 Deployed Aug 11, 2026 by sserrata via Visual Diff #2329
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.

Support OpenAPI 3.2 hierarchical tags (tags[].parent) for nested sidebar generation

1 participant