-
-
Notifications
You must be signed in to change notification settings - Fork 769
Open
Labels
Description
Describe the bug
In nitro commit fb6b85d (installed via https://pkg.pr.new/nitrojs/nitro@fb6b85d), route metadata defined via defineRouteMeta() is not reflected in OpenAPI output. When building with Vite, OpenAPI generation appears to be broken entirely (no openapi.json is generated). Non‑Vite builds still generate the file.
Reproduction
- Create a Nitro app with OpenAPI enabled:
export default defineConfig({
experimental: { openAPI: true },
openAPI: { route: '/_docs/openapi.json' }
});- Add a route that defines OpenAPI meta:
import { defineRouteMeta } from 'nitro';
import { defineHandler } from 'nitro/h3';
defineRouteMeta({
openAPI: {
tags: ['Test'],
summary: 'Test',
responses: { 200: { description: 'OK' } }
}
});
export default defineHandler(() => 'ok');- Build with Vite and check
/_docs/openapi.json.
Expected
The OpenAPI spec is generated at /_docs/openapi.json and includes route metadata (tags/summary/responses) plus any $global components defined via defineRouteMeta.
Actual
When using Vite to build, no openapi.json is generated at all. (Non‑Vite builds still generate it.)
Environment
- Nitro:
https://pkg.pr.new/nitrojs/nitro@fb6b85d(3.0.1-alpha.1) - Bun: 1.3.3 (macOS arm64)
- Preset:
cloudflare-module - Build: Vite (
vite build)