|
1 | | -# @elysiajs/swagger |
2 | | -Plugin for [elysia](https://github.com/elysiajs/elysia) to auto-generate Swagger page. |
| 1 | +# @elysiajs/openapi |
| 2 | +Plugin for [elysia](https://github.com/elysiajs/elysia) to auto-generate API documentation page. |
3 | 3 |
|
4 | 4 | ## Installation |
5 | 5 | ```bash |
6 | | -bun add @elysiajs/swagger |
| 6 | +bun add @elysiajs/openapi |
7 | 7 | ``` |
8 | 8 |
|
9 | 9 | ## Example |
10 | 10 | ```typescript |
11 | 11 | import { Elysia, t } from 'elysia' |
12 | | -import { swagger } from '@elysiajs/swagger' |
| 12 | +import { openapi } from '@elysiajs/openapi' |
13 | 13 |
|
14 | 14 | const app = new Elysia() |
15 | | - .use(swagger()) |
| 15 | + .use(openapi()) |
16 | 16 | .get('/', () => 'hi', { response: t.String({ description: 'sample description' }) }) |
17 | 17 | .post( |
18 | 18 | '/json/:id', |
@@ -43,31 +43,59 @@ const app = new Elysia() |
43 | 43 | .listen(8080); |
44 | 44 | ``` |
45 | 45 |
|
46 | | -Then go to `http://localhost:8080/swagger`. |
| 46 | +Then go to `http://localhost:8080/openapi`. |
47 | 47 |
|
48 | 48 | # config |
49 | 49 |
|
50 | | -## provider |
51 | | -@default 'scalar' |
52 | | -Choose between [Scalar](https://github.com/scalar/scalar) & [SwaggerUI](https://github.com/swagger-api/swagger-ui) |
| 50 | +## enabled |
| 51 | +@default true |
| 52 | +Enable/Disable the plugin |
53 | 53 |
|
54 | | -## scalar |
55 | | -Customize scalarConfig, refers to [Scalar config](https://github.com/scalar/scalar/blob/main/documentation/configuration.md) |
| 54 | +## documentation |
| 55 | +OpenAPI documentation information |
56 | 56 |
|
57 | | -## swagger |
58 | | -Customize Swagger config, refers to [Swagger 3.0.3 config](https://swagger.io/specification/v3) |
| 57 | +@see https://spec.openapis.org/oas/v3.0.3.html |
59 | 58 |
|
60 | | -## path |
61 | | -@default '/swagger' |
| 59 | +## exclude |
| 60 | +Configuration to exclude paths or methods from documentation |
| 61 | + |
| 62 | +## exclude.methods |
| 63 | +List of methods to exclude from documentation |
62 | 64 |
|
63 | | -The endpoint to expose Swagger |
| 65 | +## exclude.paths |
| 66 | +List of paths to exclude from documentation |
64 | 67 |
|
65 | | -## excludeStaticFile |
| 68 | +## exclude.staticFile |
66 | 69 | @default true |
67 | 70 |
|
68 | | -Determine if Swagger should exclude static files. |
| 71 | +Exclude static file routes from documentation |
69 | 72 |
|
70 | | -## exclude |
71 | | -@default [] |
| 73 | +## exclude.tags |
| 74 | +List of tags to exclude from documentation |
| 75 | + |
| 76 | +## path |
| 77 | +@default '/openapi' |
72 | 78 |
|
73 | | -Paths to exclude from the Swagger endpoint |
| 79 | +The endpoint to expose OpenAPI documentation frontend |
| 80 | + |
| 81 | +## provider |
| 82 | +@default 'scalar' |
| 83 | + |
| 84 | +OpenAPI documentation frontend between: |
| 85 | +- [Scalar](https://github.com/scalar/scalar) |
| 86 | +- [SwaggerUI](https://github.com/openapi-api/openapi-ui) |
| 87 | +- null: disable frontend |
| 88 | + |
| 89 | +## references |
| 90 | +Additional OpenAPI reference for each endpoint |
| 91 | + |
| 92 | +## scalar |
| 93 | +Scalar configuration, refers to [Scalar config](https://github.com/scalar/scalar/blob/main/documentation/configuration.md) |
| 94 | + |
| 95 | +## specPath |
| 96 | +@default '/${path}/json' |
| 97 | + |
| 98 | +The endpoint to expose OpenAPI specification in JSON format |
| 99 | + |
| 100 | +## swagger |
| 101 | +Swagger config, refers to [Swagger config](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/) |
0 commit comments