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
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/3.config/0.index.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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'
}
}
},
});
Loading
Loading