Skip to content

Commit

Permalink
Merge pull request #873 from samchon/features/typia
Browse files Browse the repository at this point in the history
Patch bug of samchon/typia#1029
  • Loading branch information
samchon committed Apr 14, 2024
2 parents 979f0c9 + 379f1c7 commit 77121e0
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 41 deletions.
4 changes: 2 additions & 2 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/core": "^3.0.2",
"@nestia/core": "^3.0.3",
"@nestjs/platform-express": "^10.3.7",
"@nestjs/platform-fastify": "^10.3.7",
"typia": "^6.0.1"
"typia": "^6.0.2"
},
"devDependencies": {
"@types/autocannon": "^7.9.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@nestia/station",
"version": "3.0.2",
"version": "3.0.3",
"description": "Nestia station",
"scripts": {
"build": "node build/index.js",
Expand Down
16 changes: 8 additions & 8 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "3.0.2",
"version": "3.0.3",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -36,25 +36,25 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.0.2",
"@nestia/fetcher": "^3.0.3",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@samchon/openapi": "^0.1.7",
"@samchon/openapi": "^0.1.12",
"detect-ts-node": "^1.0.5",
"glob": "^7.2.0",
"multer": "1.4.5-lts.1",
"raw-body": "^2.0.0",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.1",
"typia": "^6.0.1"
"rxjs": ">=6.0.2",
"typia": "^6.0.2"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.0.2",
"@nestia/fetcher": ">=3.0.3",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.1",
"typia": ">=6.0.1 <7.0.0"
"rxjs": ">=6.0.2",
"typia": ">=6.0.2 <7.0.0"
},
"devDependencies": {
"@fastify/multipart": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"ts-node": "^10.9.1",
"ts-patch": "^3.1.0",
"typescript": "^5.4.2",
"typia": "^6.0.1"
"typia": "^6.0.2"
},
"dependencies": {
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "3.0.2",
"version": "3.0.3",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions packages/migrate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/migrate",
"version": "0.13.3",
"version": "0.13.4",
"description": "Migration program from swagger to NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -34,9 +34,9 @@
},
"homepage": "https://nestia.io",
"devDependencies": {
"@nestia/core": "^3.0.2",
"@nestia/core": "^3.0.3",
"@nestia/e2e": "^0.4.3",
"@nestia/fetcher": "^3.0.2",
"@nestia/fetcher": "^3.0.3",
"@nestjs/common": "^10.3.5",
"@nestjs/core": "^10.3.5",
"@nestjs/platform-express": "^10.3.5",
Expand All @@ -58,13 +58,13 @@
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"@samchon/openapi": "^0.1.7",
"@samchon/openapi": "^0.1.12",
"commander": "10.0.0",
"inquirer": "8.2.5",
"prettier": "^3.2.5",
"tstl": "^3.0.0",
"typescript": "^5.4.3",
"typia": "^6.0.1"
"typia": "^6.0.2"
},
"files": [
"lib",
Expand Down
20 changes: 12 additions & 8 deletions packages/migrate/src/analyzers/MigrateMethodAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export namespace MigrateMethodAnalzyer {
? p.schema
: OpenApiTypeChecker.isReference(p.schema) &&
OpenApiTypeChecker.isObject(
props.document.components.schemas[
props.document.components.schemas?.[
p.schema.$ref.replace(`#/components/schemas/`, ``)
] ?? {},
)
Expand Down Expand Up @@ -148,8 +148,9 @@ export namespace MigrateMethodAnalzyer {
.map((str) =>
str[0] === "{" ? str.substring(1, str.length - 1) : str.substring(1),
);
const pathParameters: OpenApi.IOperation.IParameter[] =
route.parameters.filter((p) => p.in === "path");
const pathParameters: OpenApi.IOperation.IParameter[] = (
route.parameters ?? []
).filter((p) => p.in === "path");
if (parameterNames.length !== pathParameters.length)
if (
pathParameters.length < parameterNames.length &&
Expand All @@ -170,7 +171,7 @@ export namespace MigrateMethodAnalzyer {
);
route.parameters = [
...pathParameters,
...route.parameters.filter((p) => p.in !== "path"),
...(route.parameters ?? []).filter((p) => p.in !== "path"),
];
} else
failures.push(
Expand All @@ -196,7 +197,7 @@ export namespace MigrateMethodAnalzyer {
schema: headers,
}
: null,
parameters: route.parameters
parameters: (route.parameters ?? [])
.filter((p) => p.in === "path")
.map((p, i) => ({
name: parameterNames[i],
Expand Down Expand Up @@ -255,7 +256,7 @@ export namespace MigrateMethodAnalzyer {
if (!!description.length && !description.startsWith(route.summary))
description = `${emended}\n${description}`;
}
for (const p of route.parameters)
for (const p of route.parameters ?? [])
if (p.description) add(`@param ${p.name} ${p.description}`);
if (route.requestBody?.description)
add(`@param body ${route.requestBody.description}`);
Expand Down Expand Up @@ -288,14 +289,17 @@ export namespace MigrateMethodAnalzyer {
) =>
(meta?: {
description?: string;
content?: Record<string, OpenApi.IOperation.IMediaType>; // ISwaggerRouteBodyContent;
content?: Partial<Record<string, OpenApi.IOperation.IMediaType>>; // ISwaggerRouteBodyContent;
"x-nestia-encrypted"?: boolean;
}): false | null | IMigrateRoute.IBody => {
if (!meta?.content) return null;

const entries: [string, OpenApi.IOperation.IMediaType][] = Object.entries(
meta.content,
).filter(([_, v]) => !!v);
).filter(([_, v]) => !!v?.schema) as [
string,
OpenApi.IOperation.IMediaType,
][];
const json = entries.find((e) =>
meta["x-nestia-encrypted"] === true
? e[0].includes("text/plain") || e[0].includes("application/json")
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "3.0.2",
"version": "3.0.3",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -32,8 +32,8 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^3.0.2",
"@samchon/openapi": "^0.1.7",
"@nestia/fetcher": "^3.0.3",
"@samchon/openapi": "^0.1.12",
"cli": "^1.0.1",
"get-function-location": "^2.0.0",
"glob": "^7.2.0",
Expand All @@ -43,15 +43,15 @@
"tsconfig-paths": "^4.1.1",
"ts-node": ">=10.6.0",
"tstl": "^3.0.0",
"typia": "^6.0.1"
"typia": "^6.0.2"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.0.2",
"@nestia/fetcher": ">=3.0.3",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"ts-node": ">=10.6.0",
"typia": ">=6.0.1 <7.0.0"
"typia": ">=6.0.2 <7.0.0"
},
"devDependencies": {
"@nestia/e2e": "^0.4.1",
Expand Down
12 changes: 6 additions & 6 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@nestia/test",
"version": "3.0.2",
"version": "3.0.3",
"description": "Test program of Nestia",
"main": "index.js",
"scripts": {
Expand All @@ -26,9 +26,9 @@
},
"homepage": "https://nestia.io",
"devDependencies": {
"@nestia/sdk": "^3.0.2",
"@nestia/sdk": "^3.0.3",
"@nestjs/swagger": "^7.1.2",
"@samchon/openapi": "^0.1.7",
"@samchon/openapi": "^0.1.12",
"@types/express": "^4.17.17",
"@types/node": "20.11.16",
"@types/uuid": "^9.0.8",
Expand All @@ -40,15 +40,15 @@
},
"dependencies": {
"@fastify/multipart": "^8.1.0",
"@nestia/core": "^3.0.2",
"@nestia/core": "^3.0.3",
"@nestia/e2e": "^0.3.6",
"@nestia/fetcher": "^3.0.2",
"@nestia/fetcher": "^3.0.3",
"@nestjs/common": "^10.3.5",
"@nestjs/core": "^10.3.5",
"@nestjs/platform-express": "^10.3.5",
"@nestjs/platform-fastify": "^10.3.5",
"tstl": "^3.0.0",
"typia": "^6.0.1",
"typia": "^6.0.2",
"uuid": "^9.0.1"
}
}
6 changes: 3 additions & 3 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"@mui/icons-material": "5.15.6",
"@mui/material": "5.15.6",
"@mui/system": "5.15.6",
"@nestia/migrate": "^0.13.3",
"@samchon/openapi": "^0.1.7",
"@nestia/migrate": "^0.13.4",
"@samchon/openapi": "^0.1.12",
"@stackblitz/sdk": "^1.9.0",
"js-yaml": "^4.1.0",
"next": "14.1.0",
Expand All @@ -34,7 +34,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-mui-fileuploader": "^0.5.2",
"typia": "^6.0.1"
"typia": "^6.0.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
Expand Down

0 comments on commit 77121e0

Please sign in to comment.