Skip to content

Commit

Permalink
refactor: move swagger/openapi behind experimental flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 5, 2023
1 parent f9c833c commit 2079cab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion docs/content/3.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ Server runtime configuration.

- Default: `{}`

Enable experimental features. Currently, none are available!
Enable experimental features.

#### `openAPI`

Enable `/_nitro/swagger` and `/_nitro/openapi.json` endpoints.

#### `wasm`

Enable WASM support

#### `legacyExternals`

When enabled, lagacy (unstable) experimental rollup externals algorithm will be used.

### `storage`

Expand Down
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export async function loadOptions(
options.plugins = options.plugins.map((p) => resolvePath(p, options));

// Add open-api endpoint
if (options.dev) {
if (options.dev && options.experimental.openAPI) {
options.handlers.push({
route: "/_nitro/openapi.json",
handler: "#internal/nitro/routes/openapi",
Expand Down
1 change: 1 addition & 0 deletions src/types/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export interface NitroOptions extends PresetOptions {
experimental?: {
wasm?: boolean | RollupWasmOptions;
legacyExternals?: boolean;
openAPI?: boolean;
};
serverAssets: ServerAssetDir[];
publicAssets: PublicAssetDir[];
Expand Down

0 comments on commit 2079cab

Please sign in to comment.