Skip to content

Commit 62875de

Browse files
authored
Merge branch 'elysiajs:main' into feature/add-x-tagGroups
2 parents 828b64e + eb790a2 commit 62875de

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.3.1
2+
Bug fix:
3+
- Using relative path for specPath
4+
15
# 1.3.0-exp.1 - 1 May 2025
26
Improvement:
37
- use static response for documentation page

example/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const schema = t.Object({
55
test: t.Literal('hello')
66
})
77

8-
const app = new Elysia()
8+
const app = new Elysia({ prefix: '/api' })
99
.use(
1010
swagger({
1111
provider: 'scalar',
@@ -52,7 +52,7 @@ const app = new Elysia()
5252
}
5353
)
5454
.post('/json', ({ body }) => body, {
55-
parse: 'formdata',
55+
parse: ['json', 'formdata'],
5656
body: 'schema',
5757
response: 'schema'
5858
})

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elysiajs/swagger",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Plugin for Elysia to auto-generate Swagger page",
55
"author": {
66
"name": "saltyAom",
@@ -73,4 +73,4 @@
7373
"openapi-types": "^12.1.3",
7474
"pathe": "^1.1.2"
7575
}
76-
}
76+
}

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const swagger = <Path extends string = '/swagger'>({
4545
...documentation.info
4646
}
4747

48-
const relativePath = path.startsWith('/') ? path.slice(1) : path
48+
const relativePath = specPath.startsWith('/') ? specPath.slice(1) : specPath
4949

5050
const app = new Elysia({ name: '@elysiajs/swagger' })
5151

@@ -57,7 +57,7 @@ export const swagger = <Path extends string = '/swagger'>({
5757
theme,
5858
JSON.stringify(
5959
{
60-
url: specPath,
60+
url: relativePath,
6161
dom_id: '#swagger-ui',
6262
...swaggerOptions
6363
},
@@ -71,8 +71,8 @@ export const swagger = <Path extends string = '/swagger'>({
7171
scalarVersion,
7272
{
7373
spec: {
74-
...scalarConfig.spec,
75-
url: specPath
74+
url: relativePath,
75+
...scalarConfig.spec
7676
},
7777
...scalarConfig,
7878
// so we can showcase the elysia theme

0 commit comments

Comments
 (0)