diff --git a/example/index.ts b/example/index.ts index b7b531e..e97ac36 100644 --- a/example/index.ts +++ b/example/index.ts @@ -9,8 +9,8 @@ const app = new Elysia({ swagger({ documentation: { info: { - title: 'Elysia', - version: '0.7.0' + title: 'Elysia Swagger', + version: '0.8.1' }, tags: [ { @@ -36,8 +36,8 @@ const app = new Elysia({ }, swaggerOptions: { persistAuthorization: true - }, + } }) ) .use(plugin) - .listen(8080) + .listen(3000) diff --git a/example/index2.ts b/example/index2.ts index badcd80..19e75b4 100644 --- a/example/index2.ts +++ b/example/index2.ts @@ -43,4 +43,4 @@ const app = new Elysia({ }) ) .use(plugin) - .listen(8080) + .listen(3000) diff --git a/package.json b/package.json index 4c184c3..e0d093c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@elysiajs/swagger", - "version": "0.8.0", + "version": "0.8.1", "description": "Plugin for Elysia to auto-generate Swagger page", "author": { "name": "saltyAom", diff --git a/src/index.ts b/src/index.ts index 10d2ebd..cc9cb55 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,14 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { type Elysia, type InternalRoute } from 'elysia' +import { SwaggerUIRender } from './swagger-ui' +import { ScalarRender } from './scalar' + import { filterPaths, registerSchemaPath } from './utils' import type { OpenAPIV3 } from 'openapi-types' import type { ReferenceConfiguration } from '@scalar/api-reference' import type { ElysiaSwaggerConfig } from './types' -import { SwaggerUIRender } from './swagger-ui' -import { ScalarRender } from './scalar' /** * Plugin for [elysia](https://github.com/elysiajs/elysia) that auto-generate Swagger page. @@ -81,8 +82,16 @@ export const swagger = ...scalarConfig } - - return new Response(provider === 'swagger-ui' ? SwaggerUIRender(info, version, theme, stringifiedSwaggerOptions, autoDarkMode) : ScalarRender(scalarVersion, scalarConfiguration), + return new Response( + provider === 'swagger-ui' + ? SwaggerUIRender( + info, + version, + theme, + stringifiedSwaggerOptions, + autoDarkMode + ) + : ScalarRender(scalarVersion, scalarConfiguration), { headers: { 'content-type': 'text/html; charset=utf8'