Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(openapi): support configuration via openapi #2299

Merged
merged 11 commits into from Apr 3, 2024
Merged
26 changes: 26 additions & 0 deletions docs/3.config/0.index.md
Expand Up @@ -42,9 +42,35 @@ Enable experimental features.

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

- Default: `false`

> [!IMPORTANT]
> [Scalar](https://scalar.com/) support is currently available in [nightly channel](/guide/nightly).

You can pass an object on the root level to modify your OpenAPI specification:

```js
openAPI: {
meta: {
title: 'My Awesome Project',
description: 'This might become the next big thing.',
version: '1.0'
}
}
```

If you like to customize the Scalar integration, you can [pass a configuration object](https://github.com/scalar/scalar) like this:

```js
openAPI: {
ui: {
scalar: {
theme: 'purple'
}
}
}
```

#### `wasm`

Enable WASM support
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -131,6 +131,7 @@
"@azure/functions": "^3.5.1",
"@azure/static-web-apps-cli": "^1.1.7",
"@cloudflare/workers-types": "^4.20240320.1",
"@scalar/api-reference": "^1.20.7",
"@types/aws-lambda": "^8.10.136",
"@types/bun": "^1.0.10",
"@types/estree": "^1.0.5",
Expand Down
18 changes: 17 additions & 1 deletion playground/nitro.config.ts
@@ -1 +1,17 @@
export default defineNitroConfig({});
export default defineNitroConfig({
experimental: {
openAPI: true,
},
openAPI: {
meta: {
title: 'Foobar',
description: 'Foobar API',
version: '2.0',
},
ui: {
scalar: {
theme: 'purple'
}
}
},
});