Merge tags and tagGroups with the same name in sidebar#1959
Merge tags and tagGroups with the same name in sidebar#1959robinmoneybird wants to merge 2 commits intozuplo:mainfrom
Conversation
|
@robinmoneybird is attempting to deploy a commit to the Zuplo Team on Vercel. A member of the Team first needs to authorize it. |
|
Preview build of published Zudoku package Warning This PR is from an external contributor. To run the public package build workflow, a maintainer must add the |
|
When an OpenAPI spec has a tag and an x-tagGroups entry that share the same name (e.g. "Contacts"), they previously rendered as two separate sidebar entries — one with the tag's operations, and one wrapping the group's child tags. This merges them into a single category: the tag's own operations appear first, followed by nested child tags from the group. This is useful for specs that want to organize operations hierarchically — similar to how Enhanced Tags in OpenAPI 3.2.0 allow tags to have both direct paths and nested sub-tags. With this change, you can achieve the same structure today using x-tagGroups without ending up with duplicate sidebar entries. Example tags:
- name: Contacts
- name: Notes
x-tagGroups:
- name: Contacts
tags:
- Notes
paths:
/contacts:
get:
tags: [Contacts]
/contacts/{id}/notes:
get:
tags: [Notes]Before — two sidebar entries: After — single merged entry: |
There was a problem hiding this comment.
Pull request overview
This PR updates the OpenAPI sidebar tag navigation to mimic OpenAPI 3.2 “Enhanced tags” behavior by allowing a tag to simultaneously contain direct operations and nested child tags derived from x-tagGroups. When a tag name matches a tagGroup name, they are merged into a single sidebar category instead of appearing twice.
Changes:
- Merge tag + tagGroup entries when
group.namematches a tag name, combining the tag’s operations with the group’s child tags. - Prevent self-referential nesting when a tagGroup includes its own name in
tags. - Add test coverage for the new merging behavior and ungrouped exclusion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/zudoku/src/lib/plugins/openapi/util/buildTagCategories.ts |
Implements “consumed tags” tracking and merges same-name tag/tagGroup into a single navigation category. |
packages/zudoku/src/lib/plugins/openapi/util/buildTagCategories.test.ts |
Adds tests validating merge behavior, self-reference exclusion, and removal from ungrouped results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 WalkthroughWalkthroughUpdates the tag merging strategy in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Mimic the more permissive "Enhanced tags" behaviour from OpenAPI 3.2.0, by allowing a tag to have both direct operations and nested child tags from tagGroups. When a tag and x-tagGroup share the same name, they are now combined into a single sidebar category instead of appearing twice. However, this current implementation does not use `x-displayName` as, these could still be different tags. Only the actual `name` of a tag is considered when checking name equality.
ea80626 to
34ac750
Compare
|
Thanks for the contribution @robinmoneybird! 🚀 |
Mimic the more permissive "Enhanced tags" behaviour from OpenAPI 3.2.0, by allowing a tag to have both direct operations and nested child tags from tagGroups. When a tag and x-tagGroup share the same name, they are now combined into a single sidebar category instead of appearing twice.
However, this current implementation does not use
x-displayNameas, these could still be different tags. Only the actualnameof a tag is considered when checking name equality.Summary by CodeRabbit
Tests
Improvements