Skip to content

feat: drop swagger-generator package#786

Merged
tada5hi merged 1 commit intomasterfrom
feat/swagger-bundle-preset
May 5, 2026
Merged

feat: drop swagger-generator package#786
tada5hi merged 1 commit intomasterfrom
feat/swagger-bundle-preset

Conversation

@tada5hi
Copy link
Copy Markdown
Contributor

@tada5hi tada5hi commented May 5, 2026

Summary by CodeRabbit

  • Chores

    • Removed @routup/swagger-generator package. Users should generate OpenAPI specs using @trapi/swagger directly with the @routup/decorators/preset instead.
    • Updated release and dependency configurations accordingly.
  • Documentation

    • Expanded @routup/decorators documentation with OpenAPI generation guidance using @trapi/swagger and decorator presets.
    • Updated plugin references and integration workflows across documentation.
    • Removed swagger-generator package documentation.

Copilot AI review requested due to automatic review settings May 5, 2026 09:11
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR removes the @routup/swagger-generator package from the monorepo and updates all documentation, tests, and configuration to reflect the new integration pattern where users call @trapi/swagger directly with the @routup/decorators/preset instead. The change simplifies the API surface by removing a wrapper layer.

Changes

Package Removal & Release Configuration

Layer / File(s) Summary
Package Deletion
packages/swagger-generator/*
Entire package directory removed: src/generate-swagger.ts, src/index.ts, package.json, README.md, LICENSE, test config, and TypeScript configs.
Release Manifest Updates
.release-please-manifest.json, release-please-config.json
Removed packages/swagger-generator entry and version mapping; removed swagger linked-versions plugin group that tied generator to UI.
Plugin Registry Updates
README.md
Removed swagger-generator row from the Plugins table; swagger-ui remains as the only OpenAPI UI plugin.

Integration Pattern Migration & Documentation

Layer / File(s) Summary
Decorator Preset Integration
packages/decorators/package.json, packages/decorators/README.md
Added @trapi/swagger and jsonata as devDependencies; added "OpenAPI generation" section documenting both programmatic (generateSwagger + buildPreset) and CLI (trapi --preset) workflows using the decorators preset.
Test Migration
packages/decorators/test/unit/preset/*.spec.ts
Updated v2 and v3 preset tests to import generateSwagger and Version directly from @trapi/swagger instead of wrapper; changed buildPreset import to local ../../../src/preset; adjusted fixture paths and describe labels.
Reference Documentation
.agents/conventions.md, .agents/references/trapi.md, .agents/structure.md
Updated monorepo conventions and TRAPI integration docs to reflect that @trapi/metadata preset is now directly exposed under @routup/decorators/preset; removed swagger-generator from version groups and quick-check commands.
Plugin & Feature Docs
packages/docs/src/decorators/index.md, packages/docs/src/swagger-ui/index.md, packages/docs/src/swagger-generator/index.md, packages/docs/src/.vitepress/config.mts, packages/docs/src/.vitepress/theme/components/PluginGrid.vue
Decorators and UI docs now reference @trapi/swagger directly and link to OpenAPI generation via the decorators preset; removed dedicated swagger-generator documentation page; updated plugin grid to remove swagger-generator and adjust category descriptions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • routup/plugins#783: Both PRs make opposing changes to the same swagger-generator package surface and release configuration, suggesting coordination or a revert scenario.
  • routup/plugins#779: Both PRs modify the OpenAPI generation integration pattern by removing @routup/swagger-generator and shifting callers to use @trapi/swagger with the decorators preset directly.

Poem

A wrapper retires, its duty now done,
Direct calls to @trapi shine bright in the sun! 🐰✨
One preset, one preset, no longer split four ways,
The decorators dance clear through the monorepo's hallways.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing the swagger-generator package from the monorepo.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/swagger-bundle-preset

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…ackage

The wrapper added too little value to justify its own package, package
size, release cadence, and `generateSwagger()`-name shadowing. The
preset is the only routup-specific piece, and that already lives at
`@routup/decorators/preset`.

Consumers now call `@trapi/swagger`'s `generateSwagger()` directly
with `buildPreset()` from `@routup/decorators/preset`, or use the
`trapi` CLI with `--preset @routup/decorators/preset`. The README and
VitePress page for `@routup/decorators` gain an "OpenAPI generation"
section with the snippet.

Tests moved from `packages/swagger-generator/test/unit/{v2,v3}/` into
`packages/decorators/test/unit/preset/{v2,v3}.spec.ts` so they live
next to the decorators they validate; `@trapi/swagger` and `jsonata`
join `@routup/decorators`'s devDependencies.

Workspace cleanup: removed `packages/swagger-generator/`,
`packages/docs/src/swagger-generator/`, the release-please component
and linked-versions group, and stale references in the root README,
VitePress sidebar/grid, and agent docs.

BREAKING CHANGE: `@routup/swagger-generator` has been removed.
Replace `import { generateSwagger } from '@routup/swagger-generator'`
with `import { generateSwagger } from '@trapi/swagger'` plus
`import { buildPreset } from '@routup/decorators/preset'`, and pass
the preset explicitly via `metadata.preset`. See the
"OpenAPI generation" section in `@routup/decorators`'s README.
@tada5hi tada5hi force-pushed the feat/swagger-bundle-preset branch from 531f94b to bb13aa1 Compare May 5, 2026 09:13
@tada5hi tada5hi merged commit 7d96957 into master May 5, 2026
6 of 7 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the former @routup/swagger (generator + UI) workspace and replaces it with a focused @routup/swagger-ui package, while moving OpenAPI generation guidance and TRAPI preset ownership into @routup/decorators (./preset export) and updating docs/release metadata accordingly.

Changes:

  • Drop the packages/swagger workspace and related docs pages, and update release-please + root README to point to swagger-ui.
  • Introduce @routup/swagger-ui as a standalone Swagger UI mountable plugin (new build config, assets template, tests).
  • Move/reshape TRAPI preset usage to @routup/decorators/preset and update decorators docs + tests to call @trapi/swagger directly.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
release-please-config.json Replaces packages/swagger with packages/swagger-ui for release automation.
.release-please-manifest.json Updates manifest entry from swagger to swagger-ui.
README.md Updates plugin list to point to swagger-ui.
packages/swagger/writable/.gitignore Removed as part of deleting the swagger workspace.
packages/swagger/src/utils/index.ts Removed as part of deleting the swagger workspace.
packages/swagger/src/index.ts Removed as part of deleting the swagger workspace.
packages/swagger/src/generator/type.ts Removed generator types from deleted swagger workspace.
packages/swagger/src/generator/module.ts Removed generator implementation from deleted swagger workspace.
packages/swagger/src/generator/index.ts Removed generator exports from deleted swagger workspace.
packages/swagger/src/generator/constants.ts Removed generator constants from deleted swagger workspace.
packages/swagger/README.md Removed swagger package readme.
packages/swagger/CHANGELOG.md Removed swagger package changelog.
packages/swagger-ui/package.json Renames package to @routup/swagger-ui and adjusts deps/metadata.
packages/swagger-ui/tsdown.config.ts Adds tsdown build config for swagger-ui package.
packages/swagger-ui/tsconfig.json Minor formatting cleanup.
packages/swagger-ui/tsconfig.build.json Adds build tsconfig for swagger-ui package.
packages/swagger-ui/src/index.ts Exports swagger-ui API and adds default export.
packages/swagger-ui/src/module.ts Defines the swaggerUI() plugin wrapper.
packages/swagger-ui/src/handler.ts Core handler for serving the template and swagger-ui-dist assets.
packages/swagger-ui/src/constants.ts Defines assets path constant for template lookup.
packages/swagger-ui/src/utils.ts Adds isFileURL() helper.
packages/swagger-ui/src/url.ts Adds URL/path slash manipulation helpers.
packages/swagger-ui/src/object.ts Adds object-type guard helper.
packages/swagger-ui/src/type.ts Defines UIOptions types wrapping swagger-ui-dist config.
packages/swagger-ui/assets/template.tpl Adds HTML template for Swagger UI page.
packages/swagger-ui/README.md Adds swagger-ui package documentation.
packages/swagger-ui/LICENSE Adds MIT license file for the new package.
packages/swagger-ui/test/vitest.config.ts Adds Vitest config + coverage thresholds for swagger-ui.
packages/swagger-ui/test/unit/ui/utils.spec.ts Adds tests for isFileURL().
packages/swagger-ui/test/unit/ui/module.spec.ts Adds integration tests for template + assets serving behavior.
packages/swagger-ui/test/data/swagger.json Adds a large swagger fixture used by tests.
packages/docs/src/swagger/index.md Removes the old combined swagger docs page.
packages/docs/src/swagger/generator.md Removes the old generator docs page.
packages/docs/src/swagger-ui/index.md Rewrites docs to reference @routup/swagger-ui and TRAPI generation via decorators preset.
packages/docs/src/decorators/index.md Updates docs to describe OpenAPI generation via @routup/decorators/preset.
packages/docs/src/.vitepress/theme/components/PluginGrid.vue Updates plugin grid to show swagger-ui and updated decorators bullets.
packages/docs/src/.vitepress/config.mts Updates site description and nav links from swagger to swagger-ui.
packages/decorators/tsdown.config.ts Adds a second build entry for the ./preset subpath.
packages/decorators/package.json Adds ./preset export and optional peer dep on @trapi/metadata.
packages/decorators/src/preset/index.ts Adds preset entrypoint and exports a built preset constant.
packages/decorators/src/preset/module.ts Renames preset name and assembles class/method/parameter + swagger handlers.
packages/decorators/src/preset/class.ts Adds class-level handler(s) for TRAPI preset.
packages/decorators/src/preset/method.ts Adds method-level handler(s) for TRAPI preset.
packages/decorators/src/preset/parameter.ts Adds parameter decorator mapping handlers for TRAPI preset.
packages/decorators/src/preset/swagger.ts Adds swagger-specific decorator handlers (tags/security/description/etc.).
packages/decorators/test/unit/preset/v2.spec.ts Updates preset tests to use generateSwagger() directly and new preset import path.
packages/decorators/test/unit/preset/v3.spec.ts Updates preset tests to use generateSwagger() directly and new preset import path.
packages/decorators/README.md Adds OpenAPI generation docs pointing to TRAPI + @routup/decorators/preset.
package-lock.json Updates workspace links and dependency graph; still includes extraneous removed packages.
.agents/structure.md Updates internal repo structure documentation for swagger-ui and decorators preset.
.agents/references/trapi.md Updates TRAPI reference notes for the new preset location and generator guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot mentioned this pull request May 5, 2026
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.

2 participants