From e7e4d6b96afd0703fc199f7a50f333087441dfb8 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Mon, 24 Jun 2024 15:38:47 +0900 Subject: [PATCH] Fix `@SwaggerCuztomizer()` bug for `@internal` tagged. --- package.json | 2 +- packages/core/package.json | 6 ++-- packages/fetcher/package.json | 2 +- packages/sdk/package.json | 6 ++-- .../sdk/src/generates/SwaggerGenerator.ts | 10 +++++-- test/package.json | 8 ++--- website/deploy.js | 30 +++++++++---------- 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 4d519a90e..0a4d72c9d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@nestia/station", - "version": "3.2.5", + "version": "3.2.6", "description": "Nestia station", "scripts": { "build": "node build/index.js", diff --git a/packages/core/package.json b/packages/core/package.json index 2586dc01c..a90368bb9 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/core", - "version": "3.2.5", + "version": "3.2.6", "description": "Super-fast validation decorators of NestJS", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -36,7 +36,7 @@ }, "homepage": "https://nestia.io", "dependencies": { - "@nestia/fetcher": "^3.2.5", + "@nestia/fetcher": "^3.2.6", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "@samchon/openapi": "^0.1.21", @@ -53,7 +53,7 @@ "ws": "^7.5.3" }, "peerDependencies": { - "@nestia/fetcher": ">=3.2.5", + "@nestia/fetcher": ">=3.2.6", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "reflect-metadata": ">=0.1.12", diff --git a/packages/fetcher/package.json b/packages/fetcher/package.json index b6e422d2a..f7cee4696 100644 --- a/packages/fetcher/package.json +++ b/packages/fetcher/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/fetcher", - "version": "3.2.5", + "version": "3.2.6", "description": "Fetcher library of Nestia SDK", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 95a32406c..517c682ef 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@nestia/sdk", - "version": "3.2.5", + "version": "3.2.6", "description": "Nestia SDK and Swagger generator", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -32,7 +32,7 @@ }, "homepage": "https://nestia.io", "dependencies": { - "@nestia/fetcher": "^3.2.5", + "@nestia/fetcher": "^3.2.6", "@samchon/openapi": "^0.1.21", "cli": "^1.0.1", "get-function-location": "^2.0.0", @@ -46,7 +46,7 @@ "typia": "^6.0.3" }, "peerDependencies": { - "@nestia/fetcher": ">=3.2.5", + "@nestia/fetcher": ">=3.2.6", "@nestjs/common": ">=7.0.1", "@nestjs/core": ">=7.0.1", "reflect-metadata": ">=0.1.12", diff --git a/packages/sdk/src/generates/SwaggerGenerator.ts b/packages/sdk/src/generates/SwaggerGenerator.ts index 99731c93f..0e6f9c444 100644 --- a/packages/sdk/src/generates/SwaggerGenerator.ts +++ b/packages/sdk/src/generates/SwaggerGenerator.ts @@ -142,10 +142,13 @@ export namespace SwaggerGenerator { const method: OpenApi.Method = route.method.toLowerCase() as OpenApi.Method; const path: string = get_path(route.path, route.parameters); + const operation: OpenApi.IOperation | undefined = + swagger.paths?.[path]?.[method]; + if (operation === undefined) continue; functor.set(route.function, { method, path, - route: swagger.paths![path][method]!, + route: operation, }); } return functor; @@ -182,7 +185,10 @@ export namespace SwaggerGenerator { const path: string = get_path(route.path, route.parameters); const method: OpenApi.Method = route.method.toLowerCase() as OpenApi.Method; - const target: OpenApi.IOperation = swagger.paths![path][method]!; + const target: OpenApi.IOperation | undefined = + swagger.paths?.[path]?.[method]; + if (target === undefined) continue; + const closure: Function | Function[] = Reflect.getMetadata( "nestia/SwaggerCustomizer", route.controller.prototype, diff --git a/test/package.json b/test/package.json index f0b92a9d0..82dcb40e5 100644 --- a/test/package.json +++ b/test/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@nestia/test", - "version": "3.2.5", + "version": "3.2.6", "description": "Test program of Nestia", "main": "index.js", "scripts": { @@ -26,7 +26,7 @@ }, "homepage": "https://nestia.io", "devDependencies": { - "@nestia/sdk": "^3.2.5", + "@nestia/sdk": "^3.2.6", "@nestjs/swagger": "^7.1.2", "@samchon/openapi": "^0.1.21", "@types/express": "^4.17.17", @@ -40,9 +40,9 @@ }, "dependencies": { "@fastify/multipart": "^8.1.0", - "@nestia/core": "^3.2.5", + "@nestia/core": "^3.2.6", "@nestia/e2e": "^0.3.6", - "@nestia/fetcher": "^3.2.5", + "@nestia/fetcher": "^3.2.6", "@nestjs/common": "^10.3.5", "@nestjs/core": "^10.3.5", "@nestjs/platform-express": "^10.3.5", diff --git a/website/deploy.js b/website/deploy.js index 389dc9064..f7c035708 100644 --- a/website/deploy.js +++ b/website/deploy.js @@ -1,18 +1,18 @@ -const cp = require('child_process'); -const deploy = require('gh-pages'); +const cp = require("child_process"); +const deploy = require("gh-pages"); -cp.execSync('npm run build', { stdio: 'inherit' }); +cp.execSync("npm run build", { stdio: "inherit" }); deploy.publish( - "out", - { - branch: "gh-pages", - dotfiles: true, - }, - (err) => { - if (err) { - console.log(err); - process.exit(-1); - } else clear(); - } -); \ No newline at end of file + "out", + { + branch: "gh-pages", + dotfiles: true, + }, + (err) => { + if (err) { + console.log(err); + process.exit(-1); + } else clear(); + }, +);