@elysiajs/openapi 1.4.14 → 1.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -101
- package/bun.lock +14 -12
- package/dist/cjs/gen/index.js +1410 -3702
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +1772 -3857
- package/dist/cjs/openapi.d.ts +11 -8
- package/dist/cjs/openapi.js +301 -101
- package/dist/cjs/scalar/index.js +18 -17
- package/dist/cjs/types.d.ts +11 -3
- package/dist/gen/index.d.ts +43 -1
- package/dist/gen/index.mjs +1403 -3704
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1763 -3852
- package/dist/openapi.d.ts +11 -8
- package/dist/openapi.mjs +296 -97
- package/dist/scalar/index.mjs +18 -17
- package/dist/types.d.ts +11 -3
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -1,101 +1,131 @@
|
|
|
1
|
-
# @
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
1
|
+
# @elysia/openapi
|
|
2
|
+
|
|
3
|
+
[Elysia](https://github.com/elysiajs/elysia) plugin to add OpenAPI documentation.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @elysia/openapi
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Elysia, t } from 'elysia'
|
|
15
|
+
import { openapi } from '@elysia/openapi'
|
|
16
|
+
|
|
17
|
+
const app = new Elysia()
|
|
18
|
+
.use(openapi())
|
|
19
|
+
.get('/', () => 'hi', {
|
|
20
|
+
response: t.String({ description: 'sample description' })
|
|
21
|
+
})
|
|
22
|
+
.post(
|
|
23
|
+
'/json/:id',
|
|
24
|
+
({ body, params: { id }, query: { name } }) => ({
|
|
25
|
+
...body,
|
|
26
|
+
id,
|
|
27
|
+
name
|
|
28
|
+
}),
|
|
29
|
+
{
|
|
30
|
+
params: t.Object({
|
|
31
|
+
id: t.String()
|
|
32
|
+
}),
|
|
33
|
+
query: t.Object({
|
|
34
|
+
name: t.String()
|
|
35
|
+
}),
|
|
36
|
+
body: t.Object({
|
|
37
|
+
username: t.String(),
|
|
38
|
+
password: t.String()
|
|
39
|
+
}),
|
|
40
|
+
response: t.Object(
|
|
41
|
+
{
|
|
42
|
+
username: t.String(),
|
|
43
|
+
password: t.String(),
|
|
44
|
+
id: t.String(),
|
|
45
|
+
name: t.String()
|
|
46
|
+
},
|
|
47
|
+
{ description: 'sample description' }
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
.listen(3000)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then go to `http://localhost:3000/openapi`.
|
|
55
|
+
|
|
56
|
+
# config
|
|
57
|
+
|
|
58
|
+
## enabled
|
|
59
|
+
|
|
60
|
+
@default true
|
|
61
|
+
Enable/Disable the plugin
|
|
62
|
+
|
|
63
|
+
## openapiVersion
|
|
64
|
+
|
|
65
|
+
@default '3.1.2'
|
|
66
|
+
|
|
67
|
+
OpenAPI document version to emit. Supports OpenAPI `3.0.x` and `3.1.x`.
|
|
68
|
+
|
|
69
|
+
## documentation
|
|
70
|
+
|
|
71
|
+
OpenAPI documentation information
|
|
72
|
+
|
|
73
|
+
@see https://spec.openapis.org/oas/latest.html
|
|
74
|
+
|
|
75
|
+
## exclude
|
|
76
|
+
|
|
77
|
+
Configuration to exclude paths or methods from documentation
|
|
78
|
+
|
|
79
|
+
## exclude.methods
|
|
80
|
+
|
|
81
|
+
List of methods to exclude from documentation
|
|
82
|
+
|
|
83
|
+
## exclude.paths
|
|
84
|
+
|
|
85
|
+
List of paths to exclude from documentation
|
|
86
|
+
|
|
87
|
+
## exclude.staticFile
|
|
88
|
+
|
|
89
|
+
@default true
|
|
90
|
+
|
|
91
|
+
Exclude static file routes from documentation
|
|
92
|
+
|
|
93
|
+
## exclude.tags
|
|
94
|
+
|
|
95
|
+
List of tags to exclude from documentation
|
|
96
|
+
|
|
97
|
+
## path
|
|
98
|
+
|
|
99
|
+
@default '/openapi'
|
|
100
|
+
|
|
101
|
+
The endpoint to expose OpenAPI documentation frontend
|
|
102
|
+
|
|
103
|
+
## provider
|
|
104
|
+
|
|
105
|
+
@default 'scalar'
|
|
106
|
+
|
|
107
|
+
OpenAPI documentation frontend between:
|
|
108
|
+
|
|
109
|
+
- [Scalar](https://github.com/scalar/scalar)
|
|
110
|
+
- [SwaggerUI](https://github.com/swagger-api/swagger-ui)
|
|
111
|
+
- null: disable frontend
|
|
112
|
+
|
|
113
|
+
## references
|
|
114
|
+
|
|
115
|
+
Additional OpenAPI reference for each endpoint
|
|
116
|
+
|
|
117
|
+
## scalar
|
|
118
|
+
|
|
119
|
+
Scalar configuration, refers to [Scalar config](https://github.com/scalar/scalar/blob/main/documentation/configuration.md)
|
|
120
|
+
|
|
121
|
+
## specPath
|
|
122
|
+
|
|
123
|
+
@default '/${path}/json'
|
|
124
|
+
|
|
125
|
+
The endpoint to expose OpenAPI specification in JSON format
|
|
126
|
+
|
|
127
|
+
## swagger
|
|
128
|
+
|
|
129
|
+
Swagger config, refers to [Swagger config](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/)
|
|
130
|
+
|
|
131
|
+
See [documentation](https://elysiajs.com/plugins/openapi.html) for more details.
|
package/bun.lock
CHANGED
|
@@ -5,20 +5,22 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "@elysiajs/openapi",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@apidevtools/swagger-parser": "^12.
|
|
9
|
-
"@scalar/types": "^0.2.
|
|
8
|
+
"@apidevtools/swagger-parser": "^12.1.0",
|
|
9
|
+
"@scalar/types": "^0.2.16",
|
|
10
10
|
"@sinclair/typemap": "^0.10.1",
|
|
11
11
|
"@types/bun": "1.2.20",
|
|
12
|
-
"effect": "^3.
|
|
13
|
-
"elysia": "1.4.
|
|
12
|
+
"effect": "^3.21.2",
|
|
13
|
+
"elysia": "1.4.25",
|
|
14
14
|
"eslint": "9.6.0",
|
|
15
15
|
"openapi-types": "^12.1.3",
|
|
16
|
-
"tsup": "^8.5.
|
|
17
|
-
"typescript": "^5.9.
|
|
18
|
-
"zod": "^4.
|
|
16
|
+
"tsup": "^8.5.1",
|
|
17
|
+
"typescript": "^5.9.3",
|
|
18
|
+
"zod": "^4.3.6",
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
+
"@sinclair/typebox": ">= 0.34.0 < 1",
|
|
21
22
|
"elysia": ">= 1.4.0",
|
|
23
|
+
"typescript": ">= 5.0.0",
|
|
22
24
|
},
|
|
23
25
|
},
|
|
24
26
|
},
|
|
@@ -163,7 +165,7 @@
|
|
|
163
165
|
|
|
164
166
|
"@scalar/types": ["@scalar/types@0.2.16", "", { "dependencies": { "@scalar/openapi-types": "0.3.7", "nanoid": "5.1.5", "zod": "3.24.1" } }, "sha512-XWff9jWfYaj6q3ww94x66S6Q58u/3kA1sDOUhLAwb9va7r58bzk3NRwLOkEEdJmyEns1MEJAM53mY8KRWX6elA=="],
|
|
165
167
|
|
|
166
|
-
"@sinclair/typebox": ["@sinclair/typebox@0.34.
|
|
168
|
+
"@sinclair/typebox": ["@sinclair/typebox@0.34.48", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="],
|
|
167
169
|
|
|
168
170
|
"@sinclair/typemap": ["@sinclair/typemap@0.10.1", "", { "peerDependencies": { "@sinclair/typebox": "^0.34.30", "valibot": "^1.0.0", "zod": "^3.24.1" } }, "sha512-UXR0fhu/n3c9B6lB+SLI5t1eVpt9i9CdDrp2TajRe3LbKiUhCTZN2kSfJhjPnpc3I59jMRIhgew7+0HlMi08mg=="],
|
|
169
171
|
|
|
@@ -239,9 +241,9 @@
|
|
|
239
241
|
|
|
240
242
|
"deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="],
|
|
241
243
|
|
|
242
|
-
"effect": ["effect@3.
|
|
244
|
+
"effect": ["effect@3.22.1", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "fast-check": "^3.23.1" } }, "sha512-TNoXushmPOBAjJlthF5d2QwnX2xBPEtcNJr5XKNKbRLbDvBcOYkXlYDfvGfSA0zriwLFuCll5MDtNMAdZL17PQ=="],
|
|
243
245
|
|
|
244
|
-
"elysia": ["elysia@1.4.
|
|
246
|
+
"elysia": ["elysia@1.4.25", "", { "dependencies": { "cookie": "^1.1.1", "exact-mirror": "^0.2.7", "fast-decode-uri-component": "^1.0.1", "memoirist": "^0.4.0" }, "peerDependencies": { "@sinclair/typebox": ">= 0.34.0 < 1", "@types/bun": ">= 1.2.0", "file-type": ">= 20.0.0", "openapi-types": ">= 12.0.0", "typescript": ">= 5.0.0" }, "optionalPeers": ["@types/bun", "typescript"] }, "sha512-liKjavH99Gpzrv9cDil6uYWmPuqESfPFV1FIaFSd3iNqo3y7e29sN43VxFIK8tWWnyi6eDAmi2SZk8hNAMQMyg=="],
|
|
245
247
|
|
|
246
248
|
"esbuild": ["esbuild@0.27.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.2", "@esbuild/android-arm": "0.27.2", "@esbuild/android-arm64": "0.27.2", "@esbuild/android-x64": "0.27.2", "@esbuild/darwin-arm64": "0.27.2", "@esbuild/darwin-x64": "0.27.2", "@esbuild/freebsd-arm64": "0.27.2", "@esbuild/freebsd-x64": "0.27.2", "@esbuild/linux-arm": "0.27.2", "@esbuild/linux-arm64": "0.27.2", "@esbuild/linux-ia32": "0.27.2", "@esbuild/linux-loong64": "0.27.2", "@esbuild/linux-mips64el": "0.27.2", "@esbuild/linux-ppc64": "0.27.2", "@esbuild/linux-riscv64": "0.27.2", "@esbuild/linux-s390x": "0.27.2", "@esbuild/linux-x64": "0.27.2", "@esbuild/netbsd-arm64": "0.27.2", "@esbuild/netbsd-x64": "0.27.2", "@esbuild/openbsd-arm64": "0.27.2", "@esbuild/openbsd-x64": "0.27.2", "@esbuild/openharmony-arm64": "0.27.2", "@esbuild/sunos-x64": "0.27.2", "@esbuild/win32-arm64": "0.27.2", "@esbuild/win32-ia32": "0.27.2", "@esbuild/win32-x64": "0.27.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw=="],
|
|
247
249
|
|
|
@@ -263,7 +265,7 @@
|
|
|
263
265
|
|
|
264
266
|
"esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],
|
|
265
267
|
|
|
266
|
-
"exact-mirror": ["exact-mirror@0.2.
|
|
268
|
+
"exact-mirror": ["exact-mirror@0.2.7", "", { "peerDependencies": { "@sinclair/typebox": "^0.34.15" }, "optionalPeers": ["@sinclair/typebox"] }, "sha512-+MeEmDcLA4o/vjK2zujgk+1VTxPR4hdp23qLqkWfStbECtAq9gmsvQa3LW6z/0GXZyHJobrCnmy1cdeE7BjsYg=="],
|
|
267
269
|
|
|
268
270
|
"fast-check": ["fast-check@3.23.2", "", { "dependencies": { "pure-rand": "^6.1.0" } }, "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A=="],
|
|
269
271
|
|
|
@@ -459,7 +461,7 @@
|
|
|
459
461
|
|
|
460
462
|
"yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],
|
|
461
463
|
|
|
462
|
-
"zod": ["zod@4.
|
|
464
|
+
"zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
|
|
463
465
|
|
|
464
466
|
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
|
|
465
467
|
|