From c20b9a0421269680c2d5b943a8b0ca5451ce9ccf Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 6 Dec 2023 13:34:51 +0900 Subject: [PATCH] Working well --- bin/index.js | 72 +++++++++++++++++++++++++++++++++++++++++++++-- package-lock.json | 10 +++---- package.json | 2 +- 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/bin/index.js b/bin/index.js index 7e6ef1d..5f0fd77 100644 --- a/bin/index.js +++ b/bin/index.js @@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const typia_1 = __importDefault(require("typia")); console.log((input => { - return "object" === typeof input && null !== input && ("number" === typeof input.id && "string" === typeof input.name); + return "object" === typeof input && null !== input && ("number" === typeof input.id && (Math.floor(input.id) === input.id && 0 <= input.id && input.id <= 4294967295 && 1 <= input.id) && ("string" === typeof input.name && 2 <= input.name.length)); }).toString(), JSON.stringify({ schemas: [ { @@ -18,14 +18,80 @@ console.log((input => { type: "object", properties: { id: { + description: "Primary Key.", + "x-typia-jsDocTags": [ + { + name: "type", + text: [ + { + text: "uint", + kind: "text" + } + ] + }, + { + name: "minimum", + text: [ + { + text: "1", + kind: "text" + } + ] + } + ], "x-typia-required": true, "x-typia-optional": false, - type: "number" + type: "integer", + minimum: 1, + "x-typia-typeTags": [ + { + target: "number", + name: "Type<\"uint32\">", + kind: "type", + value: "uint32", + validate: "Math.floor($input) === $input && 0 <= $input && $input <= 4294967295", + exclusive: true + }, + { + target: "number", + name: "Minimum<1>", + kind: "minimum", + value: 1, + validate: "1 <= $input", + exclusive: [ + "minimum", + "exclusiveMinimum" + ] + } + ] }, name: { + description: "Name of the member.", + "x-typia-jsDocTags": [ + { + name: "minLength", + text: [ + { + text: "2", + kind: "text" + } + ] + } + ], "x-typia-required": true, "x-typia-optional": false, - type: "string" + type: "string", + minLength: 2, + "x-typia-typeTags": [ + { + target: "string", + name: "MinLength<2>", + kind: "minLength", + value: 2, + validate: "2 <= $input.length", + exclusive: true + } + ] } }, nullable: false, diff --git a/package-lock.json b/package-lock.json index bbcf9b2..88e3979 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "devDependencies": { "ts-node": "^10.9.1", - "ts-patch": "^3.0.2", + "ts-patch": "^3.1.0", "typescript": "^5.3.2", "typescript-transform-paths": "^3.4.6", "typia": "^5.3.4-dev.20231205" @@ -1012,16 +1012,16 @@ } }, "node_modules/ts-patch": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-3.0.2.tgz", - "integrity": "sha512-iTg8euqiNsNM1VDfOsVIsP0bM4kAVXU38n7TGQSkky7YQX/syh6sDPIRkvSS0HjT8ZOr0pq1h+5Le6jdB3hiJQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ts-patch/-/ts-patch-3.1.0.tgz", + "integrity": "sha512-KQYqDzOJjQHdCGcIoXNL4Z4jFlcyGEZXydYpHwI2gGUwQ3EqLyAjMNdIpiRZOHX7q+zPJ7QPxZJH4nwZLPdRcg==", "dev": true, "dependencies": { "chalk": "^4.1.2", "global-prefix": "^3.0.0", "minimist": "^1.2.8", "resolve": "^1.22.2", - "semver": "^7.3.8", + "semver": "^7.5.4", "strip-ansi": "^6.0.1" }, "bin": { diff --git a/package.json b/package.json index 1345bf9..0ed5b0b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "license": "ISC", "devDependencies": { "ts-node": "^10.9.1", - "ts-patch": "^3.0.2", + "ts-patch": "^3.1.0", "typescript": "^5.3.2", "typescript-transform-paths": "^3.4.6", "typia": "^5.3.4-dev.20231205"