Skip to content

Commit da0ed6d

Browse files
committed
📖 docs: update README and code to reflect changes in plugin functionality, including dependency updates and theme customization
1 parent cfac178 commit da0ed6d

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

.changeset/tricky-brooms-bake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bedtime-coders/elysia-openapi": minor
3+
---
4+
5+
Add the ability to use any theme

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
</h1>
77
<a href="https://npmjs.com/package/@bedtime-coders/elysia-openapi">
88
<img src="https://img.shields.io/npm/v/@bedtime-coders/elysia-openapi.svg?style=flat-square" alt="npm version" />
9-
</a>
10-
<a href="https://bundlephobia.com/package/@bedtime-coders/elysia-openapi">
9+
</a><a href="https://bundlephobia.com/package/@bedtime-coders/elysia-openapi">
1110
<img src="https://img.shields.io/bundlephobia/minzip/@bedtime-coders/elysia-openapi.svg?style=flat-square" alt="bundlephobia" />
12-
</a>
13-
<a href="https://elysiajs.com/">
11+
</a><a href="https://elysiajs.com/">
1412
<img src="https://img.shields.io/badge/%F0%9F%A6%8A-f6f8fa?label=elysia&color=blue" alt="elysia" />
1513
</a>
1614
</div>
1715

1816
Use this plugin to effortlessly expose a beautiful [OpenAPI](https://github.com/OAI/OpenAPI-Specification) reference page from your ElysiaJS application with zero configuration. Just add the plugin to your Elysia app and you're good to go!
1917

20-
👉 **Why use this over `@elysiajs/swagger`?** This is a fork of `@elysiajs/swagger` with updated dependencies and [a few other opinionated changes](#changes-from-elysiajs-swagger). If [@elysiajs/swagger](https://github.com/elysiajs/elysia-swagger) suits your needs (and you don't need the latest version of [Scalar API Reference](https://github.com/scalar/scalar/tree/main/packages/api-reference)), then by all means, use that instead.
18+
👉 **Why use this over `@elysiajs/swagger`?** This is a fork of `@elysiajs/swagger` with updated dependencies and [a few opinionated changes](#changes-from-elysiajs-swagger). If [@elysiajs/swagger](https://github.com/elysiajs/elysia-swagger) suits your needs (and you don't need the latest version of [Scalar API Reference](https://github.com/scalar/scalar/tree/main/packages/api-reference)), then by all means, use that instead.
2119

2220
## Add it to your Elysia app
2321
```bash
@@ -65,11 +63,13 @@ Visit `http://localhost:8080/docs` to see the generated OpenAPI reference page
6563

6664
## Changes from `@elysiajs/swagger`
6765

68-
- Update dependencies to the latest versions (at the time of writing), including [Scalar API Reference](https://github.com/scalar/scalar)
69-
- Fix code to support the latest version of these dependencies
70-
- Rename plugin from `swagger` to `openapi`
71-
- Change the default API Reference path to `/docs`, serving either Scalar API Reference (default) or Swagger UI
72-
- Change the default `openapi.json` serving path to `/docs/json`
66+
- Update core dependencies to the latest versions (at the time of writing)
67+
- Updates include [Scalar API Reference](https://github.com/scalar/scalar), enabling useful features like [`persistAuth`](https://github.com/scalar/scalar/blob/main/documentation/configuration.md#persistauth-boolean)
68+
- Fix code to fully support these updates, passing all official [tests](https://github.com/bedtime-coders/elysia-openapi/actions/workflows/test.yml)
69+
- Ability to set any `theme` for Scalar API Reference, not just `elysiajs`
70+
- Rename plugin to `openapi` (was `swagger`)
71+
- Change the default API Reference path to `/docs` (was `/swagger`)
72+
- Change the default `openapi.json` path to `/docs/json` (was `/swagger/json`)
7373

7474
## Give us a ⭐️
7575

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ export const openapi = <Path extends string = "/docs">({
7171
scalarVersion,
7272
{
7373
url: specPath,
74+
theme: "elysiajs",
7475
...scalarConfig,
75-
// so we can showcase the elysia theme
76-
_integration: "elysiajs",
7776
} satisfies Partial<ApiReferenceConfiguration>,
7877
scalarCDN,
7978
),

src/scalar/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ export const ScalarRender = (
2828
margin: 0;
2929
}
3030
</style>
31-
<style>
32-
${config.customCss ?? elysiajsTheme}
33-
</style>
31+
${config.customCss ? `<style>${config.customCss}</style>` : ""}
3432
</head>
3533
<body>
3634
<script

0 commit comments

Comments
 (0)