🔧 fix: reference model path

This commit is contained in:
saltyaom
2023-09-21 21:46:56 +07:00
parent 8c2050ed2f
commit 7a42bf0cde
4 changed files with 11 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
# 0.7.2 - 21 Sep 2023
Bug fix:
- Paths is undefined
- Models is not showing
# 0.7.1 - 20 Sep 2023
Bug fix:
- Add openapi-types as dependencies

View File

@@ -1,6 +1,6 @@
{
"name": "@elysiajs/swagger",
"version": "0.7.1",
"version": "0.7.2",
"description": "Plugin for Elysia to auto-generate Swagger page",
"author": {
"name": "saltyAom",
@@ -40,7 +40,7 @@
"devDependencies": {
"@types/node": "^20.1.4",
"bun-types": "^0.7.0",
"elysia": "0.7.0",
"elysia": "0.7.5",
"eslint": "^8.40.0",
"rimraf": "4.3",
"typescript": "^5.0.4"

View File

@@ -89,7 +89,7 @@ export const swagger =
method: route.method,
path: route.path,
// @ts-ignore
models: app.definitions,
models: app.definitions.type,
contentType: route.hooks.type
})
})
@@ -114,7 +114,7 @@ export const swagger =
...documentation.components,
schemas: {
// @ts-ignore
...app.definitions,
...app.definitions.type,
...documentation.components?.schemas
}
}

View File

@@ -180,6 +180,8 @@ export const registerSchemaPath = ({
)
}
} else if (typeof responseSchema === 'string') {
if(!(responseSchema in models)) return
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { type, properties, required, ...rest } = models[
responseSchema