Skip to content

Commit

Permalink
Merge pull request #1189 from samchon/feature/json-schema
Browse files Browse the repository at this point in the history
Fix #1188: invalid JSON schema about tuple type.
  • Loading branch information
samchon authored Jul 31, 2024
2 parents 8c34f45 + 06bcafc commit 57df81d
Show file tree
Hide file tree
Showing 37 changed files with 127 additions and 618 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": "../typia-6.6.1.tgz"
"typia": "../typia-6.6.2.tgz"
}
}
39 changes: 0 additions & 39 deletions debug/features/enum.ts

This file was deleted.

47 changes: 0 additions & 47 deletions debug/features/internal/TestValidator.ts

This file was deleted.

9 changes: 0 additions & 9 deletions debug/features/join.ts

This file was deleted.

7 changes: 7 additions & 0 deletions debug/features/tuple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import typia from "typia";

console.log(
typia.json.application<[[number, string]], "3.0">().schemas[0],
typia.json.application<[[number, string]], "3.1">().schemas[0],
typia.json.application<[[number, string, ...boolean[]]], "3.1">().schemas[0],
);
2 changes: 1 addition & 1 deletion debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"typescript": "^5.4.2"
},
"dependencies": {
"typia": "../typia-6.6.0-dev.20240727.tgz"
"typia": "../typia-6.6.1.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": "../typia-6.6.1.tgz"
"typia": "../typia-6.6.2.tgz"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typia",
"version": "6.6.1",
"version": "6.6.2",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
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.6.1",
"version": "6.6.2",
"description": "Superfast runtime validators with only one line",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -63,7 +63,7 @@
},
"homepage": "https://typia.io",
"dependencies": {
"typia": "6.6.1"
"typia": "6.6.2"
},
"peerDependencies": {
"typescript": ">=4.8.0 <5.6.0"
Expand Down
2 changes: 1 addition & 1 deletion src/programmers/internal/application_v31_tuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MetadataTuple } from "../../schemas/metadata/MetadataTuple";
export const application_v31_tuple =
(generator: (meta: Metadata) => OpenApi.IJsonSchema) =>
(tuple: MetadataTuple): OpenApi.IJsonSchema.ITuple => {
const tail: Metadata | undefined = tuple.type.elements.at(-1);
const tail: Metadata | null = tuple.type.elements.at(-1)?.rest ?? null;
const prefixItems: Metadata[] = tuple.type.isRest()
? tuple.type.elements.slice(0, -1)
: tuple.type.elements;
Expand Down
2 changes: 1 addition & 1 deletion test-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"typescript": "^5.4.5"
},
"dependencies": {
"typia": "../typia-6.6.1.tgz"
"typia": "../typia-6.6.2.tgz"
}
}
2 changes: 1 addition & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "../typia-6.6.1.tgz"
"typia": "../typia-6.6.2.tgz"
}
}
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ArrayAtomicAlias.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"$ref": "#/components/schemas/ArrayAtomicAlias.Aliasstring"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ArrayAtomicAlias.Aliasstring"
}
"additionalItems": false
},
"ArrayAtomicAlias.Aliasboolean": {
"type": "array",
Expand Down
7 changes: 1 addition & 6 deletions test/schemas/json/v3_1/ArrayAtomicSimple.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
}
}
],
"additionalItems": {
"type": "array",
"items": {
"type": "string"
}
}
"additionalItems": false
}
}
},
Expand Down
8 changes: 2 additions & 6 deletions test/schemas/json/v3_1/ArrayRepeatedUnionWithTuple.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
"type": "boolean"
}
],
"additionalItems": {
"type": "boolean"
}
"additionalItems": false
},
{
"type": "array",
Expand All @@ -52,9 +50,7 @@
"$ref": "#/components/schemas/ArrayRepeatedUnionWithTuple.IPoint3D"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ArrayRepeatedUnionWithTuple.IPoint3D"
}
"additionalItems": false
}
]
},
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/AtomicAlias.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"type": "string"
}
],
"additionalItems": {
"type": "string"
}
"additionalItems": false
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/AtomicClass.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"type": "string"
}
],
"additionalItems": {
"type": "string"
}
"additionalItems": false
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/AtomicIntersection.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"$ref": "#/components/schemas/AtomicIntersection.Wrapperstring"
}
],
"additionalItems": {
"$ref": "#/components/schemas/AtomicIntersection.Wrapperstring"
}
"additionalItems": false
},
"AtomicIntersection.Wrapperboolean": {
"type": "boolean"
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/AtomicSimple.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"type": "string"
}
],
"additionalItems": {
"type": "string"
}
"additionalItems": false
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ConstantAtomicSimple.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"const": "three"
}
],
"additionalItems": {
"const": "three"
}
"additionalItems": false
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ConstantAtomicWrapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"$ref": "#/components/schemas/ConstantAtomicWrapper.IPointerstring"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ConstantAtomicWrapper.IPointerstring"
}
"additionalItems": false
},
"ConstantAtomicWrapper.IPointerboolean": {
"type": "object",
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ConstantIntersection.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"$ref": "#/components/schemas/ConstantIntersection.Wrappertwo"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ConstantIntersection.Wrappertwo"
}
"additionalItems": false
},
"ConstantIntersection.Wrapperfalse": {
"const": false
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ObjectGeneric.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"$ref": "#/components/schemas/ObjectGeneric.ISomethingstring"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ObjectGeneric.ISomethingstring"
}
"additionalItems": false
},
"ObjectGeneric.ISomethingboolean": {
"type": "object",
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ObjectHierarchical.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
"type": "number"
}
],
"additionalItems": {
"type": "number"
}
"additionalItems": false
},
"created_at": {
"$ref": "#/components/schemas/ObjectHierarchical.ITimestamp"
Expand Down
7 changes: 1 addition & 6 deletions test/schemas/json/v3_1/ObjectPropertyNullable.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
}
}
],
"additionalItems": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ObjectPropertyNullable.IPointerObjectPropertyNullable.IMember"
}
}
"additionalItems": false
},
"ObjectPropertyNullable.IPointerboolean": {
"type": "object",
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ObjectTuple.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"$ref": "#/components/schemas/ObjectTuple.ICitizen"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ObjectTuple.ICitizen"
}
"additionalItems": false
},
"ObjectTuple.ISection": {
"type": "object",
Expand Down
7 changes: 1 addition & 6 deletions test/schemas/json/v3_1/ToJsonArray.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
}
}
],
"additionalItems": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ToJsonArray.IObject"
}
}
"additionalItems": false
},
"ToJsonArray.IObject": {
"type": "object",
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ToJsonAtomicSimple.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"type": "string"
}
],
"additionalItems": {
"type": "string"
}
"additionalItems": false
}
}
},
Expand Down
4 changes: 1 addition & 3 deletions test/schemas/json/v3_1/ToJsonTuple.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"$ref": "#/components/schemas/ToJsonTuple.IObject"
}
],
"additionalItems": {
"$ref": "#/components/schemas/ToJsonTuple.IObject"
}
"additionalItems": false
},
"ToJsonTuple.IObject": {
"$ref": "#/components/schemas/ToJsonTuple.IHobby"
Expand Down
Loading

0 comments on commit 57df81d

Please sign in to comment.