diff --git a/package.json b/package.json index 315a5db..c82bb83 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@samchon/openapi", - "version": "1.1.0", + "version": "1.1.1", "description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", "main": "./lib/index.js", "module": "./lib/index.mjs", diff --git a/src/converters/MigrateRouteConverter.ts b/src/converters/MigrateRouteConverter.ts index 362a2c4..3f99793 100644 --- a/src/converters/MigrateRouteConverter.ts +++ b/src/converters/MigrateRouteConverter.ts @@ -139,7 +139,7 @@ export namespace MigrateRouteConverter { ]), required: [ ...primitives.filter((p) => p.required).map((p) => p.name!), - ...(dto ? dto.required ?? [] : []), + ...(dto ? (dto.required ?? []) : []), ], }, ]; @@ -368,7 +368,7 @@ export namespace MigrateRouteConverter { ); if (json) { const { schema } = json[1]; - return schema || from === "request" + return schema || from === "response" ? { type: "application/json", name: "body", @@ -390,7 +390,7 @@ export namespace MigrateRouteConverter { ); if (query) { const { schema } = query[1]; - return schema || from === "request" + return schema || from === "response" ? { type: "application/x-www-form-urlencoded", name: "body", diff --git a/test/controllers/AppController.ts b/test/controllers/AppController.ts index 74a402a..2dd2833 100644 --- a/test/controllers/AppController.ts +++ b/test/controllers/AppController.ts @@ -93,6 +93,9 @@ export class AppController { }, }; } + + @TypedRoute.Get("nothing") + public nothing(): void {} } interface IQuery { diff --git a/test/features/migrate/test_http_migrate_route_return_type_void.ts b/test/features/migrate/test_http_migrate_route_return_type_void.ts new file mode 100644 index 0000000..d266bcc --- /dev/null +++ b/test/features/migrate/test_http_migrate_route_return_type_void.ts @@ -0,0 +1,18 @@ +import { TestValidator } from "@nestia/e2e"; +import { + HttpMigration, + IHttpMigrateApplication, + IHttpMigrateRoute, + OpenApi, +} from "@samchon/openapi"; + +import swagger from "../../swagger.json"; + +export const test_http_migrate_route_return_type_void = (): void => { + const document: OpenApi.IDocument = OpenApi.convert(swagger as any); + const app: IHttpMigrateApplication = HttpMigration.application(document); + const route: IHttpMigrateRoute | undefined = app.routes.find( + (r) => r.path === "/nothing" && r.method === "get", + ); + TestValidator.equals("exists")(!!route)(true); +}; diff --git a/test/swagger.json b/test/swagger.json index 34070e2..6e83b2b 100644 --- a/test/swagger.json +++ b/test/swagger.json @@ -7,7 +7,7 @@ } ], "info": { - "version": "1.0.5", + "version": "1.1.1-dev.20241008-2", "title": "@samchon/openapi", "description": "OpenAPI definitions and converters for 'typia' and 'nestia'.", "license": { @@ -374,6 +374,20 @@ } } } + }, + "/nothing": { + "get": { + "tags": [], + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": {} + } + } + } + } } }, "components": {