Skip to content

Commit 7a42bf0

Browse files
committed
🔧 fix: reference model path
1 parent 8c2050e commit 7a42bf0

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.7.2 - 21 Sep 2023
2+
Bug fix:
3+
- Paths is undefined
4+
- Models is not showing
5+
16
# 0.7.1 - 20 Sep 2023
27
Bug fix:
38
- Add openapi-types as dependencies

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": "0.7.1",
3+
"version": "0.7.2",
44
"description": "Plugin for Elysia to auto-generate Swagger page",
55
"author": {
66
"name": "saltyAom",
@@ -40,7 +40,7 @@
4040
"devDependencies": {
4141
"@types/node": "^20.1.4",
4242
"bun-types": "^0.7.0",
43-
"elysia": "0.7.0",
43+
"elysia": "0.7.5",
4444
"eslint": "^8.40.0",
4545
"rimraf": "4.3",
4646
"typescript": "^5.0.4"

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const swagger =
8989
method: route.method,
9090
path: route.path,
9191
// @ts-ignore
92-
models: app.definitions,
92+
models: app.definitions.type,
9393
contentType: route.hooks.type
9494
})
9595
})
@@ -114,7 +114,7 @@ export const swagger =
114114
...documentation.components,
115115
schemas: {
116116
// @ts-ignore
117-
...app.definitions,
117+
...app.definitions.type,
118118
...documentation.components?.schemas
119119
}
120120
}

src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ export const registerSchemaPath = ({
180180
)
181181
}
182182
} else if (typeof responseSchema === 'string') {
183+
if(!(responseSchema in models)) return
184+
183185
// eslint-disable-next-line @typescript-eslint/no-unused-vars
184186
const { type, properties, required, ...rest } = models[
185187
responseSchema

0 commit comments

Comments
 (0)