Skip to content

Commit

Permalink
Merge pull request #1033 from samchon/features/integer
Browse files Browse the repository at this point in the history
Upgrade `@samchon/openapi` and fix comment tag `@type`.
  • Loading branch information
samchon authored Apr 17, 2024
2 parents ba0e973 + 542d9a7 commit 1841dd2
Show file tree
Hide file tree
Showing 27 changed files with 313 additions and 166 deletions.
2 changes: 1 addition & 1 deletion benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "D:\\github\\samchon\\typia\\typia-6.0.2.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-6.0.3.tgz"
}
}
9 changes: 9 additions & 0 deletions debug/features/random.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import typia from "typia";

new Array(1_000).fill(0).forEach(() => {
const app = typia.random<typia.IJsonApplication>();
const result = typia.validate(app);
if (result.success === false)
console.log(JSON.stringify(result.errors, null, 2));
});
console.log("completed");
12 changes: 12 additions & 0 deletions debug/features/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import typia, { tags } from "typia";

interface Something {
/**
* @type int64
*/
value: number & tags.Minimum<3>;
}

console.log(
typia.json.application<[Something]>().components.schemas?.Something,
);
2 changes: 1 addition & 1 deletion debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"typescript": "^5.4.2"
},
"dependencies": {
"typia": "D:\\github\\samchon\\typia\\typia-6.0.2.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-6.0.3-dev.20240417.tgz"
}
}
2 changes: 1 addition & 1 deletion errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"typescript": "^5.3.2"
},
"dependencies": {
"typia": "D:\\github\\samchon\\typia\\typia-6.0.2.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-6.0.3.tgz"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "6.0.2",
"version": "6.0.3",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -65,7 +65,7 @@
},
"homepage": "https://typia.io",
"dependencies": {
"@samchon/openapi": "^0.1.14",
"@samchon/openapi": "^0.1.16",
"commander": "^10.0.0",
"comment-json": "^4.2.3",
"inquirer": "^8.2.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-json",
"version": "6.0.2",
"version": "6.0.3",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -62,7 +62,7 @@
},
"homepage": "https://typia.io",
"dependencies": {
"typia": "6.0.2"
"typia": "6.0.3"
},
"peerDependencies": {
"typescript": ">=4.8.0 <5.5.0"
Expand Down
4 changes: 3 additions & 1 deletion src/factories/MetadataCommentTagFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ const PARSER: Record<
? `-1.175494351e38 <= $input && $input <= 3.4028235e38`
: `true`,
exclusive: true,
schema: undefined,
schema: ["int32", "uint32", "int64", "uint64"].includes(Value)
? { type: "integer" }
: undefined,
},
],
bigint:
Expand Down
2 changes: 2 additions & 0 deletions test/build/internal/TestFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface TestFeature {
jsonable?: true;
primitive?: true;
resolved?: true;
random?: true;
strict?: true;
explicit?: true;
programmer?: (create: boolean) => (structure: string) => string;
Expand Down Expand Up @@ -89,6 +90,7 @@ export namespace TestFeature {
creatable: true,
spoilable: false,
resolved: true,
random: true,
programmer: write_random,
},

Expand Down
1 change: 1 addition & 0 deletions test/build/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ async function generate(
else if (feat.formData === true && s.FORMDATA !== true) continue;
else if (feat.primitive && s.PRIMITIVE === false) continue;
else if (feat.resolved && s.RESOLVABLE === false) continue;
else if (feat.random && s.RANDOM === false) continue;
else if (feat.method.toLowerCase().includes("prune") && s.ADDABLE === false)
continue;

Expand Down
4 changes: 2 additions & 2 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@samchon/openapi": "^0.1.14",
"@samchon/openapi": "^0.1.16",
"cli": "^1.0.1",
"protobufjs": "^7.2.5",
"randexp": "^0.5.3",
"source-map-support": "^0.5.21",
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "D:\\github\\samchon\\typia\\typia-6.0.2.tgz"
"typia": "D:\\github\\samchon\\typia\\typia-6.0.3.tgz"
}
}
18 changes: 9 additions & 9 deletions test/schemas/json/v3_0/CommentTagRange.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,49 @@
"type": "object",
"properties": {
"greater": {
"type": "number",
"type": "integer",
"exclusiveMinimum": true,
"minimum": 3
},
"greater_equal": {
"type": "number",
"type": "integer",
"minimum": 3
},
"less": {
"type": "number",
"type": "integer",
"exclusiveMaximum": true,
"maximum": 7
},
"less_equal": {
"type": "number",
"type": "integer",
"maximum": 7
},
"greater_less": {
"type": "number",
"type": "integer",
"exclusiveMinimum": true,
"minimum": 3,
"exclusiveMaximum": true,
"maximum": 7
},
"greater_equal_less": {
"type": "number",
"type": "integer",
"minimum": 3,
"exclusiveMaximum": true,
"maximum": 7
},
"greater_less_equal": {
"type": "number",
"type": "integer",
"exclusiveMinimum": true,
"minimum": 3,
"maximum": 7
},
"greater_equal_less_equal": {
"type": "number",
"type": "integer",
"minimum": 3,
"maximum": 7
},
"equal": {
"type": "number",
"type": "integer",
"minimum": 10,
"maximum": 10
}
Expand Down
12 changes: 6 additions & 6 deletions test/schemas/json/v3_0/CommentTagType.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@
"type": "object",
"properties": {
"int": {
"type": "number",
"type": "integer",
"title": "Integer value",
"description": "Integer value."
},
"uint": {
"type": "number",
"type": "integer",
"title": "Unsigned integer value",
"description": "Unsigned integer value."
},
"int32": {
"type": "number"
"type": "integer"
},
"uint32": {
"type": "number"
"type": "integer"
},
"int64": {
"type": "number"
"type": "integer"
},
"uint64": {
"type": "number"
"type": "integer"
},
"float": {
"type": "number"
Expand Down
31 changes: 17 additions & 14 deletions test/schemas/json/v3_0/UltimateUnion.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@
"type": "object",
"properties": {
"default": {
"type": "number"
"type": "integer"
},
"minimum": {
"type": "number"
"type": "integer"
},
"maximum": {
"type": "number"
"type": "integer"
},
"exclusiveMinimum": {
"type": "boolean"
Expand All @@ -172,7 +172,9 @@
"type": "boolean"
},
"multipleOf": {
"type": "number"
"type": "integer",
"exclusiveMinimum": true,
"minimum": 0
},
"type": {
"type": "string",
Expand Down Expand Up @@ -214,7 +216,9 @@
"type": "boolean"
},
"multipleOf": {
"type": "number"
"type": "number",
"exclusiveMinimum": true,
"minimum": 0
},
"type": {
"type": "string",
Expand Down Expand Up @@ -253,10 +257,10 @@
"type": "string"
},
"minLength": {
"type": "number"
"type": "integer"
},
"maxLength": {
"type": "number"
"type": "integer"
},
"type": {
"type": "string",
Expand Down Expand Up @@ -286,10 +290,10 @@
"$ref": "#/components/schemas/OpenApi.IJsonSchema"
},
"minItems": {
"type": "number"
"type": "integer"
},
"maxItems": {
"type": "number"
"type": "integer"
},
"type": {
"type": "string",
Expand Down Expand Up @@ -366,10 +370,10 @@
]
},
"minItems": {
"type": "number"
"type": "integer"
},
"maxItems": {
"type": "number"
"type": "integer"
},
"type": {
"type": "string",
Expand All @@ -390,7 +394,6 @@
"nullable": false,
"required": [
"prefixItems",
"additionalItems",
"type"
]
},
Expand Down Expand Up @@ -628,9 +631,9 @@
"in": {
"type": "string",
"enum": [
"cookie",
"header",
"query",
"cookie"
"query"
]
},
"name": {
Expand Down
18 changes: 9 additions & 9 deletions test/schemas/json/v3_1/CommentTagRange.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,49 @@
"type": "object",
"properties": {
"greater": {
"type": "number",
"type": "integer",
"exclusiveMinimum": true,
"minimum": 3
},
"greater_equal": {
"type": "number",
"type": "integer",
"minimum": 3
},
"less": {
"type": "number",
"type": "integer",
"exclusiveMaximum": true,
"maximum": 7
},
"less_equal": {
"type": "number",
"type": "integer",
"maximum": 7
},
"greater_less": {
"type": "number",
"type": "integer",
"exclusiveMinimum": true,
"minimum": 3,
"exclusiveMaximum": true,
"maximum": 7
},
"greater_equal_less": {
"type": "number",
"type": "integer",
"minimum": 3,
"exclusiveMaximum": true,
"maximum": 7
},
"greater_less_equal": {
"type": "number",
"type": "integer",
"exclusiveMinimum": true,
"minimum": 3,
"maximum": 7
},
"greater_equal_less_equal": {
"type": "number",
"type": "integer",
"minimum": 3,
"maximum": 7
},
"equal": {
"type": "number",
"type": "integer",
"minimum": 10,
"maximum": 10
}
Expand Down
Loading

0 comments on commit 1841dd2

Please sign in to comment.