From a226e6ab5fb31cf95623f07bea6fb0a3c747ddcd Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Tue, 12 Nov 2024 02:58:02 +0900 Subject: [PATCH] Recursive type supporting from the LLM schema. Adapt `@samchon/openapi@next`. --- benchmark/package.json | 2 +- package.json | 4 +- packages/typescript-json/package.json | 4 +- test-error/package.json | 2 +- test-esm/package.json | 2 +- test/package.json | 2 +- .../json/v3_0/ConstantAtomicSimple.json | 7 +- test/schemas/json/v3_0/TupleHierarchical.json | 24 +- test/schemas/json/v3_0/TupleRestArray.json | 3 +- test/schemas/json/v3_0/TupleRestAtomic.json | 3 +- test/schemas/json/v3_0/TupleRestObject.json | 3 +- test/schemas/json/v3_0/UltimateUnion.json | 268 +++--- test/schemas/json/v3_1/UltimateUnion.json | 268 +++--- .../schemas/llm/3.0/ConstantAtomicSimple.json | 7 +- test/schemas/llm/3.0/TupleHierarchical.json | 24 +- test/schemas/llm/3.0/TupleRestArray.json | 3 +- test/schemas/llm/3.0/TupleRestAtomic.json | 3 +- test/schemas/llm/3.0/TupleRestObject.json | 3 +- test/schemas/llm/chatgpt/UltimateUnion.json | 270 +++--- .../reflect/metadata/InstanceUnion.json | 628 +++++++------- .../reflect/metadata/UltimateUnion.json | 798 +++++++++--------- test/src/debug/schema.ts | 11 +- 22 files changed, 1169 insertions(+), 1170 deletions(-) diff --git a/benchmark/package.json b/benchmark/package.json index 0eca08527b..71f408a3a9 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -72,6 +72,6 @@ "suppress-warnings": "^1.0.2", "tstl": "^3.0.0", "uuid": "^9.0.1", - "typia": "../typia-7.0.0-dev.20241111-2.tgz" + "typia": "../typia-7.0.0-dev.20241112.tgz" } } \ No newline at end of file diff --git a/package.json b/package.json index f8797ff857..3ad722220d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typia", - "version": "7.0.0-dev.20241111-2", + "version": "7.0.0-dev.20241112", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -68,7 +68,7 @@ }, "homepage": "https://typia.io", "dependencies": { - "@samchon/openapi": "2.0.0-dev.20241111-3", + "@samchon/openapi": "2.0.0-dev.20241112", "commander": "^10.0.0", "comment-json": "^4.2.3", "inquirer": "^8.2.5", diff --git a/packages/typescript-json/package.json b/packages/typescript-json/package.json index 7208b8bc5e..62488afdfe 100644 --- a/packages/typescript-json/package.json +++ b/packages/typescript-json/package.json @@ -1,6 +1,6 @@ { "name": "typescript-json", - "version": "7.0.0-dev.20241111-2", + "version": "7.0.0-dev.20241112", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -64,7 +64,7 @@ }, "homepage": "https://typia.io", "dependencies": { - "typia": "7.0.0-dev.20241111-2" + "typia": "7.0.0-dev.20241112" }, "peerDependencies": { "typescript": ">=4.8.0 <5.7.0" diff --git a/test-error/package.json b/test-error/package.json index 36aa4d9c74..0233e0996d 100644 --- a/test-error/package.json +++ b/test-error/package.json @@ -32,6 +32,6 @@ "typescript": "^5.3.2" }, "dependencies": { - "typia": "../typia-7.0.0-dev.20241111-2.tgz" + "typia": "../typia-7.0.0-dev.20241112.tgz" } } \ No newline at end of file diff --git a/test-esm/package.json b/test-esm/package.json index eb5969f6ae..dcb221aa82 100644 --- a/test-esm/package.json +++ b/test-esm/package.json @@ -36,6 +36,6 @@ "typescript": "^5.4.5" }, "dependencies": { - "typia": "../typia-7.0.0-dev.20241111-2.tgz" + "typia": "../typia-7.0.0-dev.20241112.tgz" } } \ No newline at end of file diff --git a/test/package.json b/test/package.json index 1796e63096..9c0c192b32 100644 --- a/test/package.json +++ b/test/package.json @@ -53,6 +53,6 @@ "suppress-warnings": "^1.0.2", "tstl": "^3.0.0", "uuid": "^9.0.1", - "typia": "../typia-7.0.0-dev.20241111-2.tgz" + "typia": "../typia-7.0.0-dev.20241112.tgz" } } \ No newline at end of file diff --git a/test/schemas/json/v3_0/ConstantAtomicSimple.json b/test/schemas/json/v3_0/ConstantAtomicSimple.json index d8390c9cb9..3dfdb2531e 100644 --- a/test/schemas/json/v3_0/ConstantAtomicSimple.json +++ b/test/schemas/json/v3_0/ConstantAtomicSimple.json @@ -9,12 +9,7 @@ { "type": "boolean", "enum": [ - false - ] - }, - { - "type": "boolean", - "enum": [ + false, true ] }, diff --git a/test/schemas/json/v3_0/TupleHierarchical.json b/test/schemas/json/v3_0/TupleHierarchical.json index d201dbf747..6b924359b6 100644 --- a/test/schemas/json/v3_0/TupleHierarchical.json +++ b/test/schemas/json/v3_0/TupleHierarchical.json @@ -7,23 +7,20 @@ "items": { "oneOf": [ { - "type": "boolean" + "type": "boolean", + "nullable": true }, { - "type": "null" - }, - { - "type": "number" + "type": "number", + "nullable": true }, { "type": "array", "items": { "oneOf": [ { - "type": "boolean" - }, - { - "type": "null" + "type": "boolean", + "nullable": true }, { "type": "array", @@ -50,12 +47,14 @@ ] }, "minItems": 2, - "maxItems": 2 + "maxItems": 2, + "nullable": true } ] }, "minItems": 3, - "maxItems": 3 + "maxItems": 3, + "nullable": true }, { "type": "array", @@ -118,7 +117,8 @@ ] }, "minItems": 2, - "maxItems": 2 + "maxItems": 2, + "nullable": true } ] }, diff --git a/test/schemas/json/v3_0/TupleRestArray.json b/test/schemas/json/v3_0/TupleRestArray.json index baee1adf17..51b261117c 100644 --- a/test/schemas/json/v3_0/TupleRestArray.json +++ b/test/schemas/json/v3_0/TupleRestArray.json @@ -20,7 +20,8 @@ } ] }, - "minItems": 2 + "minItems": 2, + "maxItems": 2 } } }, diff --git a/test/schemas/json/v3_0/TupleRestAtomic.json b/test/schemas/json/v3_0/TupleRestAtomic.json index a42d5a30ca..474be6b0b9 100644 --- a/test/schemas/json/v3_0/TupleRestAtomic.json +++ b/test/schemas/json/v3_0/TupleRestAtomic.json @@ -17,7 +17,8 @@ } ] }, - "minItems": 2 + "minItems": 2, + "maxItems": 2 } } }, diff --git a/test/schemas/json/v3_0/TupleRestObject.json b/test/schemas/json/v3_0/TupleRestObject.json index a368fae0dd..30c08056cd 100644 --- a/test/schemas/json/v3_0/TupleRestObject.json +++ b/test/schemas/json/v3_0/TupleRestObject.json @@ -17,7 +17,8 @@ } ] }, - "minItems": 2 + "minItems": 2, + "maxItems": 2 }, "TupleRestObject.IObject": { "type": "object", diff --git a/test/schemas/json/v3_0/UltimateUnion.json b/test/schemas/json/v3_0/UltimateUnion.json index 65417e1444..47004e7766 100644 --- a/test/schemas/json/v3_0/UltimateUnion.json +++ b/test/schemas/json/v3_0/UltimateUnion.json @@ -64,19 +64,19 @@ "OpenApi.IJsonSchema": { "oneOf": [ { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -103,72 +103,43 @@ "title": "Type schema info", "description": "Type schema info.\n\n`OpenApi.IJsonSchema` is a type schema info of the OpenAPI.\n\n`OpenApi.IJsonSchema` basically follows the JSON schema definition of\nOpenAPI v3.1, but a little bit shrinked to remove ambiguous and duplicated\nexpressions of OpenAPI v3.1 for the convenience and clarity.\n\n- Decompose mixed type: {@link OpenApiV3_1.IJsonSchema.IMixed}\n- Resolve nullable property: {@link OpenApiV3_1.IJsonSchema.__ISignificant.nullable}\n- Array type utilizes only single {@link OpenAPI.IJsonSchema.IArray.items}\n- Tuple type utilizes only {@link OpenApi.IJsonSchema.ITuple.prefixItems}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAnyOf} to {@link OpenApi.IJsonSchema.IOneOf}\n- Merge {@link OpenApiV3_1.IJsonSchema.IRecursiveReference} to {@link OpenApi.IJsonSchema.IReference}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAllOf} to {@link OpenApi.IJsonSchema.IObject}" }, - "OpenApi.IJsonSchema.IConstant": { + "OpenApi.IJsonSchema.IString": { "type": "object", "properties": { - "const": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ], - "title": "The constant value", - "description": "The constant value." + "default": { + "type": "string", + "title": "Default value", + "description": "Default value." }, - "title": { + "format": { "type": "string", - "title": "Title of the schema", - "description": "Title of the schema." + "title": "Format restriction", + "description": "Format restriction." }, - "description": { + "pattern": { "type": "string", - "title": "Detailed description of the schema", - "description": "Detailed description of the schema." + "title": "Pattern restriction", + "description": "Pattern restriction." }, - "deprecated": { - "type": "boolean", - "title": "Whether the type is deprecated or not", - "description": "Whether the type is deprecated or not." + "contentMediaType": { + "type": "string", + "title": "Content media type restriction", + "description": "Content media type restriction." }, - "example": { - "title": "Example value", - "description": "Example value." + "minLength": { + "type": "integer", + "title": "Minimum length restriction", + "description": "Minimum length restriction." }, - "examples": { - "$ref": "#/components/schemas/Recordstringany", - "title": "List of example values as key-value pairs", - "description": "List of example values as key-value pairs." - } - }, - "required": [ - "const" - ], - "description": "Constant value type." - }, - "Recordstringany": { - "type": "object", - "properties": {}, - "description": "Construct a type with a set of properties K of type T", - "additionalProperties": {} - }, - "OpenApi.IJsonSchema.IBoolean": { - "type": "object", - "properties": { - "default": { - "type": "boolean", - "title": "The default value", - "description": "The default value." + "maxLength": { + "type": "integer", + "title": "Maximum length restriction", + "description": "Maximum length restriction." }, "type": { "type": "string", "enum": [ - "boolean" + "string" ], "title": "Discriminator value of the type", "description": "Discriminator value of the type." @@ -201,38 +172,44 @@ "required": [ "type" ], - "description": "Boolean type info." + "description": "String type info." }, - "OpenApi.IJsonSchema.IInteger": { + "Recordstringany": { + "type": "object", + "properties": {}, + "description": "Construct a type with a set of properties K of type T", + "additionalProperties": {} + }, + "OpenApi.IJsonSchema.INumber": { "type": "object", "properties": { "default": { - "type": "integer", + "type": "number", "title": "Default value", "description": "Default value." }, "minimum": { - "type": "integer", + "type": "number", "title": "Minimum value restriction", "description": "Minimum value restriction." }, "maximum": { - "type": "integer", + "type": "number", "title": "Maximum value restriction", "description": "Maximum value restriction." }, "exclusiveMinimum": { "type": "boolean", "title": "Exclusive minimum value restriction", - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." }, "exclusiveMaximum": { "type": "boolean", "title": "Exclusive maximum value restriction", - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." }, "multipleOf": { - "type": "integer", + "type": "number", "exclusiveMinimum": true, "minimum": 0, "title": "Multiple of value restriction", @@ -241,7 +218,7 @@ "type": { "type": "string", "enum": [ - "integer" + "number" ], "title": "Discriminator value of the type", "description": "Discriminator value of the type." @@ -274,47 +251,68 @@ "required": [ "type" ], - "description": "Integer type info." + "description": "Number (double) type info." }, - "OpenApi.IJsonSchema.INumber": { + "OpenApi.IJsonSchema.IConstant": { "type": "object", "properties": { - "default": { - "type": "number", - "title": "Default value", - "description": "Default value." + "const": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ], + "title": "The constant value", + "description": "The constant value." }, - "minimum": { - "type": "number", - "title": "Minimum value restriction", - "description": "Minimum value restriction." + "title": { + "type": "string", + "title": "Title of the schema", + "description": "Title of the schema." }, - "maximum": { - "type": "number", - "title": "Maximum value restriction", - "description": "Maximum value restriction." + "description": { + "type": "string", + "title": "Detailed description of the schema", + "description": "Detailed description of the schema." }, - "exclusiveMinimum": { + "deprecated": { "type": "boolean", - "title": "Exclusive minimum value restriction", - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." + "title": "Whether the type is deprecated or not", + "description": "Whether the type is deprecated or not." }, - "exclusiveMaximum": { - "type": "boolean", - "title": "Exclusive maximum value restriction", - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." + "example": { + "title": "Example value", + "description": "Example value." }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": true, - "minimum": 0, - "title": "Multiple of value restriction", - "description": "Multiple of value restriction." + "examples": { + "$ref": "#/components/schemas/Recordstringany", + "title": "List of example values as key-value pairs", + "description": "List of example values as key-value pairs." + } + }, + "required": [ + "const" + ], + "description": "Constant value type." + }, + "OpenApi.IJsonSchema.IBoolean": { + "type": "object", + "properties": { + "default": { + "type": "boolean", + "title": "The default value", + "description": "The default value." }, "type": { "type": "string", "enum": [ - "number" + "boolean" ], "title": "Discriminator value of the type", "description": "Discriminator value of the type." @@ -347,45 +345,47 @@ "required": [ "type" ], - "description": "Number (double) type info." + "description": "Boolean type info." }, - "OpenApi.IJsonSchema.IString": { + "OpenApi.IJsonSchema.IInteger": { "type": "object", "properties": { "default": { - "type": "string", + "type": "integer", "title": "Default value", "description": "Default value." }, - "format": { - "type": "string", - "title": "Format restriction", - "description": "Format restriction." + "minimum": { + "type": "integer", + "title": "Minimum value restriction", + "description": "Minimum value restriction." }, - "pattern": { - "type": "string", - "title": "Pattern restriction", - "description": "Pattern restriction." + "maximum": { + "type": "integer", + "title": "Maximum value restriction", + "description": "Maximum value restriction." }, - "contentMediaType": { - "type": "string", - "title": "Content media type restriction", - "description": "Content media type restriction." + "exclusiveMinimum": { + "type": "boolean", + "title": "Exclusive minimum value restriction", + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." }, - "minLength": { - "type": "integer", - "title": "Minimum length restriction", - "description": "Minimum length restriction." + "exclusiveMaximum": { + "type": "boolean", + "title": "Exclusive maximum value restriction", + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." }, - "maxLength": { + "multipleOf": { "type": "integer", - "title": "Maximum length restriction", - "description": "Maximum length restriction." + "exclusiveMinimum": true, + "minimum": 0, + "title": "Multiple of value restriction", + "description": "Multiple of value restriction." }, "type": { "type": "string", "enum": [ - "string" + "integer" ], "title": "Discriminator value of the type", "description": "Discriminator value of the type." @@ -418,7 +418,7 @@ "required": [ "type" ], - "description": "String type info." + "description": "Integer type info." }, "OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema": { "type": "object", @@ -499,19 +499,19 @@ "type": "boolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -606,19 +606,19 @@ "type": "boolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -737,19 +737,19 @@ "items": { "oneOf": [ { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" diff --git a/test/schemas/json/v3_1/UltimateUnion.json b/test/schemas/json/v3_1/UltimateUnion.json index 78d92b56f7..78ad64a579 100644 --- a/test/schemas/json/v3_1/UltimateUnion.json +++ b/test/schemas/json/v3_1/UltimateUnion.json @@ -61,19 +61,19 @@ "OpenApi.IJsonSchema": { "oneOf": [ { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -100,70 +100,41 @@ "title": "Type schema info", "description": "Type schema info.\n\n`OpenApi.IJsonSchema` is a type schema info of the OpenAPI.\n\n`OpenApi.IJsonSchema` basically follows the JSON schema definition of\nOpenAPI v3.1, but a little bit shrinked to remove ambiguous and duplicated\nexpressions of OpenAPI v3.1 for the convenience and clarity.\n\n- Decompose mixed type: {@link OpenApiV3_1.IJsonSchema.IMixed}\n- Resolve nullable property: {@link OpenApiV3_1.IJsonSchema.__ISignificant.nullable}\n- Array type utilizes only single {@link OpenAPI.IJsonSchema.IArray.items}\n- Tuple type utilizes only {@link OpenApi.IJsonSchema.ITuple.prefixItems}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAnyOf} to {@link OpenApi.IJsonSchema.IOneOf}\n- Merge {@link OpenApiV3_1.IJsonSchema.IRecursiveReference} to {@link OpenApi.IJsonSchema.IReference}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAllOf} to {@link OpenApi.IJsonSchema.IObject}" }, - "OpenApi.IJsonSchema.IConstant": { + "OpenApi.IJsonSchema.IString": { "type": "object", "properties": { - "const": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ], - "title": "The constant value", - "description": "The constant value." + "default": { + "type": "string", + "title": "Default value", + "description": "Default value." }, - "title": { + "format": { "type": "string", - "title": "Title of the schema", - "description": "Title of the schema." + "title": "Format restriction", + "description": "Format restriction." }, - "description": { + "pattern": { "type": "string", - "title": "Detailed description of the schema", - "description": "Detailed description of the schema." + "title": "Pattern restriction", + "description": "Pattern restriction." }, - "deprecated": { - "type": "boolean", - "title": "Whether the type is deprecated or not", - "description": "Whether the type is deprecated or not." + "contentMediaType": { + "type": "string", + "title": "Content media type restriction", + "description": "Content media type restriction." }, - "example": { - "title": "Example value", - "description": "Example value." + "minLength": { + "type": "integer", + "title": "Minimum length restriction", + "description": "Minimum length restriction." }, - "examples": { - "$ref": "#/components/schemas/Recordstringany", - "title": "List of example values as key-value pairs", - "description": "List of example values as key-value pairs." - } - }, - "required": [ - "const" - ], - "description": "Constant value type." - }, - "Recordstringany": { - "type": "object", - "properties": {}, - "description": "Construct a type with a set of properties K of type T", - "additionalProperties": {} - }, - "OpenApi.IJsonSchema.IBoolean": { - "type": "object", - "properties": { - "default": { - "type": "boolean", - "title": "The default value", - "description": "The default value." + "maxLength": { + "type": "integer", + "title": "Maximum length restriction", + "description": "Maximum length restriction." }, "type": { - "const": "boolean", + "const": "string", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -195,45 +166,51 @@ "required": [ "type" ], - "description": "Boolean type info." + "description": "String type info." }, - "OpenApi.IJsonSchema.IInteger": { + "Recordstringany": { + "type": "object", + "properties": {}, + "description": "Construct a type with a set of properties K of type T", + "additionalProperties": {} + }, + "OpenApi.IJsonSchema.INumber": { "type": "object", "properties": { "default": { - "type": "integer", + "type": "number", "title": "Default value", "description": "Default value." }, "minimum": { - "type": "integer", + "type": "number", "title": "Minimum value restriction", "description": "Minimum value restriction." }, "maximum": { - "type": "integer", + "type": "number", "title": "Maximum value restriction", "description": "Maximum value restriction." }, "exclusiveMinimum": { "type": "boolean", "title": "Exclusive minimum value restriction", - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." }, "exclusiveMaximum": { "type": "boolean", "title": "Exclusive maximum value restriction", - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." }, "multipleOf": { - "type": "integer", + "type": "number", "exclusiveMinimum": true, "minimum": 0, "title": "Multiple of value restriction", "description": "Multiple of value restriction." }, "type": { - "const": "integer", + "const": "number", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -265,45 +242,66 @@ "required": [ "type" ], - "description": "Integer type info." + "description": "Number (double) type info." }, - "OpenApi.IJsonSchema.INumber": { + "OpenApi.IJsonSchema.IConstant": { "type": "object", "properties": { - "default": { - "type": "number", - "title": "Default value", - "description": "Default value." + "const": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ], + "title": "The constant value", + "description": "The constant value." }, - "minimum": { - "type": "number", - "title": "Minimum value restriction", - "description": "Minimum value restriction." + "title": { + "type": "string", + "title": "Title of the schema", + "description": "Title of the schema." }, - "maximum": { - "type": "number", - "title": "Maximum value restriction", - "description": "Maximum value restriction." + "description": { + "type": "string", + "title": "Detailed description of the schema", + "description": "Detailed description of the schema." }, - "exclusiveMinimum": { + "deprecated": { "type": "boolean", - "title": "Exclusive minimum value restriction", - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." + "title": "Whether the type is deprecated or not", + "description": "Whether the type is deprecated or not." }, - "exclusiveMaximum": { - "type": "boolean", - "title": "Exclusive maximum value restriction", - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." + "example": { + "title": "Example value", + "description": "Example value." }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": true, - "minimum": 0, - "title": "Multiple of value restriction", - "description": "Multiple of value restriction." + "examples": { + "$ref": "#/components/schemas/Recordstringany", + "title": "List of example values as key-value pairs", + "description": "List of example values as key-value pairs." + } + }, + "required": [ + "const" + ], + "description": "Constant value type." + }, + "OpenApi.IJsonSchema.IBoolean": { + "type": "object", + "properties": { + "default": { + "type": "boolean", + "title": "The default value", + "description": "The default value." }, "type": { - "const": "number", + "const": "boolean", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -335,43 +333,45 @@ "required": [ "type" ], - "description": "Number (double) type info." + "description": "Boolean type info." }, - "OpenApi.IJsonSchema.IString": { + "OpenApi.IJsonSchema.IInteger": { "type": "object", "properties": { "default": { - "type": "string", + "type": "integer", "title": "Default value", "description": "Default value." }, - "format": { - "type": "string", - "title": "Format restriction", - "description": "Format restriction." + "minimum": { + "type": "integer", + "title": "Minimum value restriction", + "description": "Minimum value restriction." }, - "pattern": { - "type": "string", - "title": "Pattern restriction", - "description": "Pattern restriction." + "maximum": { + "type": "integer", + "title": "Maximum value restriction", + "description": "Maximum value restriction." }, - "contentMediaType": { - "type": "string", - "title": "Content media type restriction", - "description": "Content media type restriction." + "exclusiveMinimum": { + "type": "boolean", + "title": "Exclusive minimum value restriction", + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." }, - "minLength": { - "type": "integer", - "title": "Minimum length restriction", - "description": "Minimum length restriction." + "exclusiveMaximum": { + "type": "boolean", + "title": "Exclusive maximum value restriction", + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." }, - "maxLength": { + "multipleOf": { "type": "integer", - "title": "Maximum length restriction", - "description": "Maximum length restriction." + "exclusiveMinimum": true, + "minimum": 0, + "title": "Multiple of value restriction", + "description": "Multiple of value restriction." }, "type": { - "const": "string", + "const": "integer", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -403,7 +403,7 @@ "required": [ "type" ], - "description": "String type info." + "description": "Integer type info." }, "OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema": { "type": "object", @@ -481,19 +481,19 @@ "type": "boolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -585,19 +585,19 @@ "type": "boolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -713,19 +713,19 @@ "items": { "oneOf": [ { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.INumber" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/components/schemas/OpenApi.IJsonSchema.IString" + "$ref": "#/components/schemas/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/components/schemas/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" diff --git a/test/schemas/llm/3.0/ConstantAtomicSimple.json b/test/schemas/llm/3.0/ConstantAtomicSimple.json index b29c2a06f5..031d320b2c 100644 --- a/test/schemas/llm/3.0/ConstantAtomicSimple.json +++ b/test/schemas/llm/3.0/ConstantAtomicSimple.json @@ -5,12 +5,7 @@ { "type": "boolean", "enum": [ - false - ] - }, - { - "type": "boolean", - "enum": [ + false, true ] }, diff --git a/test/schemas/llm/3.0/TupleHierarchical.json b/test/schemas/llm/3.0/TupleHierarchical.json index e1ce8d968f..d0cbf97175 100644 --- a/test/schemas/llm/3.0/TupleHierarchical.json +++ b/test/schemas/llm/3.0/TupleHierarchical.json @@ -3,23 +3,20 @@ "items": { "oneOf": [ { - "type": "boolean" + "type": "boolean", + "nullable": true }, { - "type": "null" - }, - { - "type": "number" + "type": "number", + "nullable": true }, { "type": "array", "items": { "oneOf": [ { - "type": "boolean" - }, - { - "type": "null" + "type": "boolean", + "nullable": true }, { "type": "array", @@ -46,12 +43,14 @@ ] }, "minItems": 2, - "maxItems": 2 + "maxItems": 2, + "nullable": true } ] }, "minItems": 3, - "maxItems": 3 + "maxItems": 3, + "nullable": true }, { "type": "array", @@ -114,7 +113,8 @@ ] }, "minItems": 2, - "maxItems": 2 + "maxItems": 2, + "nullable": true } ] }, diff --git a/test/schemas/llm/3.0/TupleRestArray.json b/test/schemas/llm/3.0/TupleRestArray.json index 98b9dcf82e..82cd4e2539 100644 --- a/test/schemas/llm/3.0/TupleRestArray.json +++ b/test/schemas/llm/3.0/TupleRestArray.json @@ -16,5 +16,6 @@ } ] }, - "minItems": 2 + "minItems": 2, + "maxItems": 2 } \ No newline at end of file diff --git a/test/schemas/llm/3.0/TupleRestAtomic.json b/test/schemas/llm/3.0/TupleRestAtomic.json index e0857629a7..f7f2b00d92 100644 --- a/test/schemas/llm/3.0/TupleRestAtomic.json +++ b/test/schemas/llm/3.0/TupleRestAtomic.json @@ -13,5 +13,6 @@ } ] }, - "minItems": 2 + "minItems": 2, + "maxItems": 2 } \ No newline at end of file diff --git a/test/schemas/llm/3.0/TupleRestObject.json b/test/schemas/llm/3.0/TupleRestObject.json index 3614a60aa1..977cdc6136 100644 --- a/test/schemas/llm/3.0/TupleRestObject.json +++ b/test/schemas/llm/3.0/TupleRestObject.json @@ -22,5 +22,6 @@ } ] }, - "minItems": 2 + "minItems": 2, + "maxItems": 2 } \ No newline at end of file diff --git a/test/schemas/llm/chatgpt/UltimateUnion.json b/test/schemas/llm/chatgpt/UltimateUnion.json index 4f508ed25d..2daa9d77e0 100644 --- a/test/schemas/llm/chatgpt/UltimateUnion.json +++ b/test/schemas/llm/chatgpt/UltimateUnion.json @@ -62,19 +62,19 @@ "OpenApi.IJsonSchema": { "oneOf": [ { - "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" + "$ref": "#/$defs/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" + "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" + "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IString" + "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/$defs/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -101,71 +101,41 @@ "title": "Type schema info", "description": "Type schema info.\n\n`OpenApi.IJsonSchema` is a type schema info of the OpenAPI.\n\n`OpenApi.IJsonSchema` basically follows the JSON schema definition of\nOpenAPI v3.1, but a little bit shrinked to remove ambiguous and duplicated\nexpressions of OpenAPI v3.1 for the convenience and clarity.\n\n- Decompose mixed type: {@link OpenApiV3_1.IJsonSchema.IMixed}\n- Resolve nullable property: {@link OpenApiV3_1.IJsonSchema.__ISignificant.nullable}\n- Array type utilizes only single {@link OpenAPI.IJsonSchema.IArray.items}\n- Tuple type utilizes only {@link OpenApi.IJsonSchema.ITuple.prefixItems}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAnyOf} to {@link OpenApi.IJsonSchema.IOneOf}\n- Merge {@link OpenApiV3_1.IJsonSchema.IRecursiveReference} to {@link OpenApi.IJsonSchema.IReference}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAllOf} to {@link OpenApi.IJsonSchema.IObject}" }, - "OpenApi.IJsonSchema.IConstant": { + "OpenApi.IJsonSchema.IString": { "type": "object", "properties": { - "const": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - }, - { - "type": "boolean" - } - ], - "title": "The constant value", - "description": "The constant value." + "default": { + "type": "string", + "title": "Default value", + "description": "Default value." }, - "title": { + "format": { "type": "string", - "title": "Title of the schema", - "description": "Title of the schema." + "title": "Format restriction", + "description": "Format restriction." }, - "description": { + "pattern": { "type": "string", - "title": "Detailed description of the schema", - "description": "Detailed description of the schema." + "title": "Pattern restriction", + "description": "Pattern restriction." }, - "deprecated": { - "type": "boolean", - "title": "Whether the type is deprecated or not", - "description": "Whether the type is deprecated or not." + "contentMediaType": { + "type": "string", + "title": "Content media type restriction", + "description": "Content media type restriction." }, - "example": { - "title": "Example value", - "description": "Example value." + "minLength": { + "type": "integer", + "title": "Minimum length restriction", + "description": "Minimum length restriction." }, - "examples": { - "$ref": "#/$defs/Recordstringany", - "title": "List of example values as key-value pairs", - "description": "List of example values as key-value pairs." - } - }, - "required": [ - "const" - ], - "description": "Constant value type.", - "additionalProperties": false - }, - "Recordstringany": { - "type": "object", - "properties": {}, - "description": "Construct a type with a set of properties K of type T", - "additionalProperties": {} - }, - "OpenApi.IJsonSchema.IBoolean": { - "type": "object", - "properties": { - "default": { - "type": "boolean", - "title": "The default value", - "description": "The default value." + "maxLength": { + "type": "integer", + "title": "Maximum length restriction", + "description": "Maximum length restriction." }, "type": { - "const": "boolean", + "const": "string", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -197,46 +167,52 @@ "required": [ "type" ], - "description": "Boolean type info.", + "description": "String type info.", "additionalProperties": false }, - "OpenApi.IJsonSchema.IInteger": { + "Recordstringany": { + "type": "object", + "properties": {}, + "description": "Construct a type with a set of properties K of type T", + "additionalProperties": {} + }, + "OpenApi.IJsonSchema.INumber": { "type": "object", "properties": { "default": { - "type": "integer", + "type": "number", "title": "Default value", "description": "Default value." }, "minimum": { - "type": "integer", + "type": "number", "title": "Minimum value restriction", "description": "Minimum value restriction." }, "maximum": { - "type": "integer", + "type": "number", "title": "Maximum value restriction", "description": "Maximum value restriction." }, "exclusiveMinimum": { "type": "boolean", "title": "Exclusive minimum value restriction", - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." }, "exclusiveMaximum": { "type": "boolean", "title": "Exclusive maximum value restriction", - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." }, "multipleOf": { - "type": "integer", + "type": "number", "exclusiveMinimum": true, "minimum": 0, "title": "Multiple of value restriction", "description": "Multiple of value restriction." }, "type": { - "const": "integer", + "const": "number", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -268,46 +244,68 @@ "required": [ "type" ], - "description": "Integer type info.", + "description": "Number (double) type info.", "additionalProperties": false }, - "OpenApi.IJsonSchema.INumber": { + "OpenApi.IJsonSchema.IConstant": { "type": "object", "properties": { - "default": { - "type": "number", - "title": "Default value", - "description": "Default value." + "const": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ], + "title": "The constant value", + "description": "The constant value." }, - "minimum": { - "type": "number", - "title": "Minimum value restriction", - "description": "Minimum value restriction." + "title": { + "type": "string", + "title": "Title of the schema", + "description": "Title of the schema." }, - "maximum": { - "type": "number", - "title": "Maximum value restriction", - "description": "Maximum value restriction." + "description": { + "type": "string", + "title": "Detailed description of the schema", + "description": "Detailed description of the schema." }, - "exclusiveMinimum": { + "deprecated": { "type": "boolean", - "title": "Exclusive minimum value restriction", - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." + "title": "Whether the type is deprecated or not", + "description": "Whether the type is deprecated or not." }, - "exclusiveMaximum": { - "type": "boolean", - "title": "Exclusive maximum value restriction", - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." + "example": { + "title": "Example value", + "description": "Example value." }, - "multipleOf": { - "type": "number", - "exclusiveMinimum": true, - "minimum": 0, - "title": "Multiple of value restriction", - "description": "Multiple of value restriction." + "examples": { + "$ref": "#/$defs/Recordstringany", + "title": "List of example values as key-value pairs", + "description": "List of example values as key-value pairs." + } + }, + "required": [ + "const" + ], + "description": "Constant value type.", + "additionalProperties": false + }, + "OpenApi.IJsonSchema.IBoolean": { + "type": "object", + "properties": { + "default": { + "type": "boolean", + "title": "The default value", + "description": "The default value." }, "type": { - "const": "number", + "const": "boolean", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -339,44 +337,46 @@ "required": [ "type" ], - "description": "Number (double) type info.", + "description": "Boolean type info.", "additionalProperties": false }, - "OpenApi.IJsonSchema.IString": { + "OpenApi.IJsonSchema.IInteger": { "type": "object", "properties": { "default": { - "type": "string", + "type": "integer", "title": "Default value", "description": "Default value." }, - "format": { - "type": "string", - "title": "Format restriction", - "description": "Format restriction." + "minimum": { + "type": "integer", + "title": "Minimum value restriction", + "description": "Minimum value restriction." }, - "pattern": { - "type": "string", - "title": "Pattern restriction", - "description": "Pattern restriction." + "maximum": { + "type": "integer", + "title": "Maximum value restriction", + "description": "Maximum value restriction." }, - "contentMediaType": { - "type": "string", - "title": "Content media type restriction", - "description": "Content media type restriction." + "exclusiveMinimum": { + "type": "boolean", + "title": "Exclusive minimum value restriction", + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property." }, - "minLength": { - "type": "integer", - "title": "Minimum length restriction", - "description": "Minimum length restriction." + "exclusiveMaximum": { + "type": "boolean", + "title": "Exclusive maximum value restriction", + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property." }, - "maxLength": { + "multipleOf": { "type": "integer", - "title": "Maximum length restriction", - "description": "Maximum length restriction." + "exclusiveMinimum": true, + "minimum": 0, + "title": "Multiple of value restriction", + "description": "Multiple of value restriction." }, "type": { - "const": "string", + "const": "integer", "title": "Discriminator value of the type", "description": "Discriminator value of the type." }, @@ -408,7 +408,7 @@ "required": [ "type" ], - "description": "String type info.", + "description": "Integer type info.", "additionalProperties": false }, "OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema": { @@ -488,19 +488,19 @@ "type": "boolean" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" + "$ref": "#/$defs/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" + "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" + "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IString" + "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/$defs/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -593,19 +593,19 @@ "type": "boolean" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" + "$ref": "#/$defs/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" + "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" + "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IString" + "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/$defs/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" @@ -723,19 +723,19 @@ "items": { "oneOf": [ { - "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" + "$ref": "#/$defs/OpenApi.IJsonSchema.IString" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" + "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.INumber" + "$ref": "#/$defs/OpenApi.IJsonSchema.IConstant" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" + "$ref": "#/$defs/OpenApi.IJsonSchema.IBoolean" }, { - "$ref": "#/$defs/OpenApi.IJsonSchema.IString" + "$ref": "#/$defs/OpenApi.IJsonSchema.IInteger" }, { "$ref": "#/$defs/OpenApi.IJsonSchema.IArrayOpenApi.IJsonSchema" diff --git a/test/schemas/reflect/metadata/InstanceUnion.json b/test/schemas/reflect/metadata/InstanceUnion.json index fdd16007d4..e85ae5e046 100644 --- a/test/schemas/reflect/metadata/InstanceUnion.json +++ b/test/schemas/reflect/metadata/InstanceUnion.json @@ -28,7 +28,7 @@ "components": { "objects": [ { - "name": "ObjectUnionExplicit.Discriminator<\"point\", ObjectUnionExplicit.IPoint>", + "name": "ObjectSimple.IBox3D", "properties": [ { "key": { @@ -43,7 +43,7 @@ "type": "string", "values": [ { - "value": "x", + "value": "scale", "tags": [] } ] @@ -66,19 +66,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [ - { - "type": "number", - "tags": [] - } - ], + "atomics": [], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [], + "objects": [ + { + "name": "ObjectSimple.IPoint3D", + "tags": [] + } + ], "aliases": [], "natives": [], "sets": [], @@ -100,7 +100,7 @@ "type": "string", "values": [ { - "value": "y", + "value": "position", "tags": [] } ] @@ -123,19 +123,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [ - { - "type": "number", - "tags": [] - } - ], + "atomics": [], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [], + "objects": [ + { + "name": "ObjectSimple.IPoint3D", + "tags": [] + } + ], "aliases": [], "natives": [], "sets": [], @@ -157,7 +157,7 @@ "type": "string", "values": [ { - "value": "type", + "value": "rotate", "tags": [] } ] @@ -175,6 +175,34 @@ "maps": [] }, "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ + { + "name": "ObjectSimple.IPoint3D", + "tags": [] + } + ], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": null, + "jsDocTags": [] + }, + { + "key": { "any": false, "required": true, "optional": false, @@ -186,7 +214,7 @@ "type": "string", "values": [ { - "value": "point", + "value": "pivot", "tags": [] } ] @@ -203,6 +231,30 @@ "sets": [], "maps": [] }, + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ + { + "name": "ObjectSimple.IPoint3D", + "tags": [] + } + ], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, "description": null, "jsDocTags": [] } @@ -215,7 +267,7 @@ ] }, { - "name": "ObjectUnionExplicit.Discriminator<\"line\", ObjectUnionExplicit.ILine>", + "name": "ObjectSimple.IPoint3D", "properties": [ { "key": { @@ -230,7 +282,7 @@ "type": "string", "values": [ { - "value": "p1", + "value": "x", "tags": [] } ] @@ -253,19 +305,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [], + "atomics": [ + { + "type": "number", + "tags": [] + } + ], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectUnionExplicit.IPoint", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -287,7 +339,7 @@ "type": "string", "values": [ { - "value": "p2", + "value": "y", "tags": [] } ] @@ -310,19 +362,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [], + "atomics": [ + { + "type": "number", + "tags": [] + } + ], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectUnionExplicit.IPoint", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -344,7 +396,7 @@ "type": "string", "values": [ { - "value": "type", + "value": "z", "tags": [] } ] @@ -367,18 +419,13 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [], - "constants": [ + "atomics": [ { - "type": "string", - "values": [ - { - "value": "line", - "tags": [] - } - ] + "type": "number", + "tags": [] } ], + "constants": [], "templates": [], "escaped": null, "rest": null, @@ -402,7 +449,7 @@ ] }, { - "name": "ObjectUnionExplicit.IPoint", + "name": "ObjectUnionExplicit.Discriminator<\"point\", ObjectUnionExplicit.IPoint>", "properties": [ { "key": { @@ -517,18 +564,7 @@ }, "description": null, "jsDocTags": [] - } - ], - "jsDocTags": [], - "index": 2, - "recursive": false, - "nullables": [ - false - ] - }, - { - "name": "ObjectUnionExplicit.Discriminator<\"triangle\", ObjectUnionExplicit.ITriangle>", - "properties": [ + }, { "key": { "any": false, @@ -542,7 +578,7 @@ "type": "string", "values": [ { - "value": "p1", + "value": "type", "tags": [] } ] @@ -566,18 +602,23 @@ "nullable": false, "functions": [], "atomics": [], - "constants": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "point", + "tags": [] + } + ] + } + ], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectUnionExplicit.IPoint", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -585,7 +626,18 @@ }, "description": null, "jsDocTags": [] - }, + } + ], + "jsDocTags": [], + "index": 2, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "ObjectUnionExplicit.Discriminator<\"line\", ObjectUnionExplicit.ILine>", + "properties": [ { "key": { "any": false, @@ -599,7 +651,7 @@ "type": "string", "values": [ { - "value": "p2", + "value": "p1", "tags": [] } ] @@ -656,7 +708,7 @@ "type": "string", "values": [ { - "value": "p3", + "value": "p2", "tags": [] } ] @@ -742,7 +794,7 @@ "type": "string", "values": [ { - "value": "triangle", + "value": "line", "tags": [] } ] @@ -771,7 +823,7 @@ ] }, { - "name": "ObjectUnionExplicit.Discriminator<\"rectangle\", ObjectUnionExplicit.IRectangle>", + "name": "ObjectUnionExplicit.IPoint", "properties": [ { "key": { @@ -786,7 +838,7 @@ "type": "string", "values": [ { - "value": "p1", + "value": "x", "tags": [] } ] @@ -809,19 +861,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [], + "atomics": [ + { + "type": "number", + "tags": [] + } + ], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectUnionExplicit.IPoint", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -843,7 +895,7 @@ "type": "string", "values": [ { - "value": "p2", + "value": "y", "tags": [] } ] @@ -866,19 +918,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [], + "atomics": [ + { + "type": "number", + "tags": [] + } + ], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectUnionExplicit.IPoint", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -886,7 +938,18 @@ }, "description": null, "jsDocTags": [] - }, + } + ], + "jsDocTags": [], + "index": 4, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "ObjectUnionExplicit.Discriminator<\"triangle\", ObjectUnionExplicit.ITriangle>", + "properties": [ { "key": { "any": false, @@ -900,7 +963,7 @@ "type": "string", "values": [ { - "value": "p3", + "value": "p1", "tags": [] } ] @@ -957,7 +1020,7 @@ "type": "string", "values": [ { - "value": "p4", + "value": "p2", "tags": [] } ] @@ -1014,7 +1077,7 @@ "type": "string", "values": [ { - "value": "type", + "value": "p3", "tags": [] } ] @@ -1038,91 +1101,18 @@ "nullable": false, "functions": [], "atomics": [], - "constants": [ + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ { - "type": "string", - "values": [ - { - "value": "rectangle", - "tags": [] - } - ] - } - ], - "templates": [], - "escaped": null, - "rest": null, - "arrays": [], - "tuples": [], - "objects": [], - "aliases": [], - "natives": [], - "sets": [], - "maps": [] - }, - "description": null, - "jsDocTags": [] - } - ], - "jsDocTags": [], - "index": 4, - "recursive": false, - "nullables": [ - false - ] - }, - { - "name": "ObjectUnionExplicit.Discriminator<\"polyline\", ObjectUnionExplicit.IPolyline>", - "properties": [ - { - "key": { - "any": false, - "required": true, - "optional": false, - "nullable": false, - "functions": [], - "atomics": [], - "constants": [ - { - "type": "string", - "values": [ - { - "value": "points", - "tags": [] - } - ] - } - ], - "templates": [], - "escaped": null, - "rest": null, - "arrays": [], - "tuples": [], - "objects": [], - "aliases": [], - "natives": [], - "sets": [], - "maps": [] - }, - "value": { - "any": false, - "required": true, - "optional": false, - "nullable": false, - "functions": [], - "atomics": [], - "constants": [], - "templates": [], - "escaped": null, - "rest": null, - "arrays": [ - { - "name": "Array", + "name": "ObjectUnionExplicit.IPoint", "tags": [] } ], - "tuples": [], - "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1173,7 +1163,7 @@ "type": "string", "values": [ { - "value": "polyline", + "value": "triangle", "tags": [] } ] @@ -1202,7 +1192,7 @@ ] }, { - "name": "ObjectUnionExplicit.Discriminator<\"polygon\", ObjectUnionExplicit.IPolygon>", + "name": "ObjectUnionExplicit.Discriminator<\"rectangle\", ObjectUnionExplicit.IRectangle>", "properties": [ { "key": { @@ -1217,7 +1207,7 @@ "type": "string", "values": [ { - "value": "outer", + "value": "p1", "tags": [] } ] @@ -1249,7 +1239,7 @@ "tuples": [], "objects": [ { - "name": "ObjectUnionExplicit.IPolyline", + "name": "ObjectUnionExplicit.IPoint", "tags": [] } ], @@ -1274,7 +1264,7 @@ "type": "string", "values": [ { - "value": "inner", + "value": "p2", "tags": [] } ] @@ -1302,14 +1292,14 @@ "templates": [], "escaped": null, "rest": null, - "arrays": [ + "arrays": [], + "tuples": [], + "objects": [ { - "name": "Array", + "name": "ObjectUnionExplicit.IPoint", "tags": [] } ], - "tuples": [], - "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1331,7 +1321,7 @@ "type": "string", "values": [ { - "value": "type", + "value": "p3", "tags": [] } ] @@ -1355,23 +1345,18 @@ "nullable": false, "functions": [], "atomics": [], - "constants": [ - { - "type": "string", - "values": [ - { - "value": "polygon", - "tags": [] - } - ] - } - ], + "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [], + "objects": [ + { + "name": "ObjectUnionExplicit.IPoint", + "tags": [] + } + ], "aliases": [], "natives": [], "sets": [], @@ -1379,18 +1364,7 @@ }, "description": null, "jsDocTags": [] - } - ], - "jsDocTags": [], - "index": 6, - "recursive": false, - "nullables": [ - false - ] - }, - { - "name": "ObjectUnionExplicit.IPolyline", - "properties": [ + }, { "key": { "any": false, @@ -1404,7 +1378,7 @@ "type": "string", "values": [ { - "value": "points", + "value": "p4", "tags": [] } ] @@ -1432,14 +1406,14 @@ "templates": [], "escaped": null, "rest": null, - "arrays": [ + "arrays": [], + "tuples": [], + "objects": [ { - "name": "Array", + "name": "ObjectUnionExplicit.IPoint", "tags": [] } ], - "tuples": [], - "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1447,18 +1421,7 @@ }, "description": null, "jsDocTags": [] - } - ], - "jsDocTags": [], - "index": 7, - "recursive": false, - "nullables": [ - false - ] - }, - { - "name": "ObjectUnionExplicit.Discriminator<\"circle\", ObjectUnionExplicit.ICircle>", - "properties": [ + }, { "key": { "any": false, @@ -1472,7 +1435,7 @@ "type": "string", "values": [ { - "value": "centroid", + "value": "type", "tags": [] } ] @@ -1496,18 +1459,23 @@ "nullable": false, "functions": [], "atomics": [], - "constants": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "rectangle", + "tags": [] + } + ] + } + ], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectUnionExplicit.IPoint", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1515,7 +1483,18 @@ }, "description": null, "jsDocTags": [] - }, + } + ], + "jsDocTags": [], + "index": 6, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "ObjectUnionExplicit.Discriminator<\"polyline\", ObjectUnionExplicit.IPolyline>", + "properties": [ { "key": { "any": false, @@ -1529,7 +1508,7 @@ "type": "string", "values": [ { - "value": "radius", + "value": "points", "tags": [] } ] @@ -1552,17 +1531,17 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [ - { - "type": "number", - "tags": [] - } - ], + "atomics": [], "constants": [], "templates": [], "escaped": null, "rest": null, - "arrays": [], + "arrays": [ + { + "name": "Array", + "tags": [] + } + ], "tuples": [], "objects": [], "aliases": [], @@ -1615,7 +1594,7 @@ "type": "string", "values": [ { - "value": "circle", + "value": "polyline", "tags": [] } ] @@ -1637,14 +1616,14 @@ } ], "jsDocTags": [], - "index": 8, + "index": 7, "recursive": false, "nullables": [ false ] }, { - "name": "ObjectSimple.IBox3D", + "name": "ObjectUnionExplicit.Discriminator<\"polygon\", ObjectUnionExplicit.IPolygon>", "properties": [ { "key": { @@ -1659,7 +1638,7 @@ "type": "string", "values": [ { - "value": "scale", + "value": "outer", "tags": [] } ] @@ -1691,7 +1670,7 @@ "tuples": [], "objects": [ { - "name": "ObjectSimple.IPoint3D", + "name": "ObjectUnionExplicit.IPolyline", "tags": [] } ], @@ -1716,7 +1695,7 @@ "type": "string", "values": [ { - "value": "position", + "value": "inner", "tags": [] } ] @@ -1744,14 +1723,14 @@ "templates": [], "escaped": null, "rest": null, - "arrays": [], - "tuples": [], - "objects": [ + "arrays": [ { - "name": "ObjectSimple.IPoint3D", + "name": "Array", "tags": [] } ], + "tuples": [], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1773,7 +1752,7 @@ "type": "string", "values": [ { - "value": "rotate", + "value": "type", "tags": [] } ] @@ -1797,18 +1776,23 @@ "nullable": false, "functions": [], "atomics": [], - "constants": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "polygon", + "tags": [] + } + ] + } + ], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "ObjectSimple.IPoint3D", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1816,7 +1800,18 @@ }, "description": null, "jsDocTags": [] - }, + } + ], + "jsDocTags": [], + "index": 8, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "ObjectUnionExplicit.IPolyline", + "properties": [ { "key": { "any": false, @@ -1830,7 +1825,7 @@ "type": "string", "values": [ { - "value": "pivot", + "value": "points", "tags": [] } ] @@ -1858,14 +1853,14 @@ "templates": [], "escaped": null, "rest": null, - "arrays": [], - "tuples": [], - "objects": [ + "arrays": [ { - "name": "ObjectSimple.IPoint3D", + "name": "Array", "tags": [] } ], + "tuples": [], + "objects": [], "aliases": [], "natives": [], "sets": [], @@ -1883,7 +1878,7 @@ ] }, { - "name": "ObjectSimple.IPoint3D", + "name": "ObjectUnionExplicit.Discriminator<\"circle\", ObjectUnionExplicit.ICircle>", "properties": [ { "key": { @@ -1898,7 +1893,7 @@ "type": "string", "values": [ { - "value": "x", + "value": "centroid", "tags": [] } ] @@ -1921,19 +1916,19 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [ - { - "type": "number", - "tags": [] - } - ], + "atomics": [], "constants": [], "templates": [], "escaped": null, "rest": null, "arrays": [], "tuples": [], - "objects": [], + "objects": [ + { + "name": "ObjectUnionExplicit.IPoint", + "tags": [] + } + ], "aliases": [], "natives": [], "sets": [], @@ -1955,7 +1950,7 @@ "type": "string", "values": [ { - "value": "y", + "value": "radius", "tags": [] } ] @@ -2012,7 +2007,7 @@ "type": "string", "values": [ { - "value": "z", + "value": "type", "tags": [] } ] @@ -2035,13 +2030,18 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [ + "atomics": [], + "constants": [ { - "type": "number", - "tags": [] + "type": "string", + "values": [ + { + "value": "circle", + "tags": [] + } + ] } ], - "constants": [], "templates": [], "escaped": null, "rest": null, @@ -2091,11 +2091,11 @@ "tags": [] }, { - "name": "ObjectUnionExplicit", + "name": "Array", "tags": [] }, { - "name": "Array", + "name": "ObjectUnionExplicit", "tags": [] } ], @@ -2237,6 +2237,38 @@ "recursive": false, "index": null }, + { + "name": "Array", + "value": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "boolean", + "tags": [] + } + ], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "nullables": [ + false + ], + "recursive": false, + "index": null + }, { "name": "ObjectUnionExplicit", "value": { @@ -2356,38 +2388,6 @@ ], "recursive": false, "index": null - }, - { - "name": "Array", - "value": { - "any": false, - "required": true, - "optional": false, - "nullable": false, - "functions": [], - "atomics": [ - { - "type": "boolean", - "tags": [] - } - ], - "constants": [], - "templates": [], - "escaped": null, - "rest": null, - "arrays": [], - "tuples": [], - "objects": [], - "aliases": [], - "natives": [], - "sets": [], - "maps": [] - }, - "nullables": [ - false - ], - "recursive": false, - "index": null } ], "tuples": [ diff --git a/test/schemas/reflect/metadata/UltimateUnion.json b/test/schemas/reflect/metadata/UltimateUnion.json index 4c3bf5d3aa..ae966c0f90 100644 --- a/test/schemas/reflect/metadata/UltimateUnion.json +++ b/test/schemas/reflect/metadata/UltimateUnion.json @@ -440,23 +440,23 @@ "tuples": [], "objects": [ { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IBoolean", + "name": "OpenApi.IJsonSchema.INumber", "tags": [] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.IBoolean", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "tags": [] }, { @@ -506,7 +506,7 @@ ] }, { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "properties": [ { "key": { @@ -521,7 +521,7 @@ "type": "string", "values": [ { - "value": "const", + "value": "default", "tags": [] } ] @@ -541,21 +541,13 @@ "value": { "any": false, "required": true, - "optional": false, + "optional": true, "nullable": false, "functions": [], "atomics": [ { "type": "string", "tags": [] - }, - { - "type": "number", - "tags": [] - }, - { - "type": "boolean", - "tags": [] } ], "constants": [], @@ -570,7 +562,7 @@ "sets": [], "maps": [] }, - "description": "The constant value.", + "description": "Default value.", "jsDocTags": [] }, { @@ -586,7 +578,7 @@ "type": "string", "values": [ { - "value": "title", + "value": "format", "tags": [] } ] @@ -627,7 +619,7 @@ "sets": [], "maps": [] }, - "description": "Title of the schema.", + "description": "Format restriction.", "jsDocTags": [] }, { @@ -643,7 +635,7 @@ "type": "string", "values": [ { - "value": "description", + "value": "pattern", "tags": [] } ] @@ -684,7 +676,7 @@ "sets": [], "maps": [] }, - "description": "Detailed description of the schema.", + "description": "Pattern restriction.", "jsDocTags": [] }, { @@ -700,7 +692,7 @@ "type": "string", "values": [ { - "value": "deprecated", + "value": "contentMediaType", "tags": [] } ] @@ -725,7 +717,7 @@ "functions": [], "atomics": [ { - "type": "boolean", + "type": "string", "tags": [] } ], @@ -741,7 +733,7 @@ "sets": [], "maps": [] }, - "description": "Whether the type is deprecated or not.", + "description": "Content media type restriction.", "jsDocTags": [] }, { @@ -757,7 +749,7 @@ "type": "string", "values": [ { - "value": "example", + "value": "minLength", "tags": [] } ] @@ -775,12 +767,31 @@ "maps": [] }, "value": { - "any": true, + "any": false, "required": true, "optional": true, "nullable": false, "functions": [], - "atomics": [], + "atomics": [ + { + "type": "number", + "tags": [ + [ + { + "target": "number", + "name": "Type<\"uint64\">", + "kind": "type", + "value": "uint64", + "validate": "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615", + "exclusive": true, + "schema": { + "type": "integer" + } + } + ] + ] + } + ], "constants": [], "templates": [], "escaped": null, @@ -793,8 +804,18 @@ "sets": [], "maps": [] }, - "description": "Example value.", - "jsDocTags": [] + "description": "Minimum length restriction.", + "jsDocTags": [ + { + "name": "type", + "text": [ + { + "text": "uint64", + "kind": "text" + } + ] + } + ] }, { "key": { @@ -809,7 +830,7 @@ "type": "string", "values": [ { - "value": "examples", + "value": "maxLength", "tags": [] } ] @@ -832,50 +853,24 @@ "optional": true, "nullable": false, "functions": [], - "atomics": [], - "constants": [], - "templates": [], - "escaped": null, - "rest": null, - "arrays": [], - "tuples": [], - "objects": [ - { - "name": "Record", - "tags": [] - } - ], - "aliases": [], - "natives": [], - "sets": [], - "maps": [] - }, - "description": "List of example values as key-value pairs.", - "jsDocTags": [] - } - ], - "description": "Constant value type.", - "jsDocTags": [], - "index": 3, - "recursive": false, - "nullables": [ - false - ] - }, - { - "name": "Record", - "properties": [ - { - "key": { - "any": false, - "required": true, - "optional": false, - "nullable": false, - "functions": [], "atomics": [ { - "type": "string", - "tags": [] + "type": "number", + "tags": [ + [ + { + "target": "number", + "name": "Type<\"uint64\">", + "kind": "type", + "value": "uint64", + "validate": "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615", + "exclusive": true, + "schema": { + "type": "integer" + } + } + ] + ] } ], "constants": [], @@ -890,40 +885,19 @@ "sets": [], "maps": [] }, - "value": { - "any": true, - "required": true, - "optional": false, - "nullable": false, - "functions": [], - "atomics": [], - "constants": [], - "templates": [], - "escaped": null, - "rest": null, - "arrays": [], - "tuples": [], - "objects": [], - "aliases": [], - "natives": [], - "sets": [], - "maps": [] - }, - "description": null, - "jsDocTags": [] - } - ], - "description": "Construct a type with a set of properties K of type T", - "jsDocTags": [], - "index": 4, - "recursive": false, - "nullables": [ - false - ] - }, - { - "name": "OpenApi.IJsonSchema.IBoolean", - "properties": [ + "description": "Maximum length restriction.", + "jsDocTags": [ + { + "name": "type", + "text": [ + { + "text": "uint64", + "kind": "text" + } + ] + } + ] + }, { "key": { "any": false, @@ -937,7 +911,7 @@ "type": "string", "values": [ { - "value": "default", + "value": "type", "tags": [] } ] @@ -957,16 +931,21 @@ "value": { "any": false, "required": true, - "optional": true, + "optional": false, "nullable": false, "functions": [], - "atomics": [ + "atomics": [], + "constants": [ { - "type": "boolean", - "tags": [] + "type": "string", + "values": [ + { + "value": "string", + "tags": [] + } + ] } ], - "constants": [], "templates": [], "escaped": null, "rest": null, @@ -978,7 +957,7 @@ "sets": [], "maps": [] }, - "description": "The default value.", + "description": "Discriminator value of the type.", "jsDocTags": [] }, { @@ -994,7 +973,7 @@ "type": "string", "values": [ { - "value": "type", + "value": "title", "tags": [] } ] @@ -1014,21 +993,16 @@ "value": { "any": false, "required": true, - "optional": false, + "optional": true, "nullable": false, "functions": [], - "atomics": [], - "constants": [ + "atomics": [ { "type": "string", - "values": [ - { - "value": "boolean", - "tags": [] - } - ] + "tags": [] } ], + "constants": [], "templates": [], "escaped": null, "rest": null, @@ -1040,7 +1014,7 @@ "sets": [], "maps": [] }, - "description": "Discriminator value of the type.", + "description": "Title of the schema.", "jsDocTags": [] }, { @@ -1056,7 +1030,7 @@ "type": "string", "values": [ { - "value": "title", + "value": "description", "tags": [] } ] @@ -1097,7 +1071,7 @@ "sets": [], "maps": [] }, - "description": "Title of the schema.", + "description": "Detailed description of the schema.", "jsDocTags": [] }, { @@ -1113,7 +1087,7 @@ "type": "string", "values": [ { - "value": "description", + "value": "deprecated", "tags": [] } ] @@ -1138,7 +1112,7 @@ "functions": [], "atomics": [ { - "type": "string", + "type": "boolean", "tags": [] } ], @@ -1154,7 +1128,7 @@ "sets": [], "maps": [] }, - "description": "Detailed description of the schema.", + "description": "Whether the type is deprecated or not.", "jsDocTags": [] }, { @@ -1170,7 +1144,7 @@ "type": "string", "values": [ { - "value": "deprecated", + "value": "example", "tags": [] } ] @@ -1188,17 +1162,12 @@ "maps": [] }, "value": { - "any": false, + "any": true, "required": true, "optional": true, "nullable": false, "functions": [], - "atomics": [ - { - "type": "boolean", - "tags": [] - } - ], + "atomics": [], "constants": [], "templates": [], "escaped": null, @@ -1211,7 +1180,7 @@ "sets": [], "maps": [] }, - "description": "Whether the type is deprecated or not.", + "description": "Example value.", "jsDocTags": [] }, { @@ -1227,7 +1196,7 @@ "type": "string", "values": [ { - "value": "example", + "value": "examples", "tags": [] } ] @@ -1245,7 +1214,7 @@ "maps": [] }, "value": { - "any": true, + "any": false, "required": true, "optional": true, "nullable": false, @@ -1257,15 +1226,32 @@ "rest": null, "arrays": [], "tuples": [], - "objects": [], + "objects": [ + { + "name": "Record", + "tags": [] + } + ], "aliases": [], "natives": [], "sets": [], "maps": [] }, - "description": "Example value.", + "description": "List of example values as key-value pairs.", "jsDocTags": [] - }, + } + ], + "description": "String type info.", + "jsDocTags": [], + "index": 3, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "Record", + "properties": [ { "key": { "any": false, @@ -1273,18 +1259,13 @@ "optional": false, "nullable": false, "functions": [], - "atomics": [], - "constants": [ + "atomics": [ { "type": "string", - "values": [ - { - "value": "examples", - "tags": [] - } - ] + "tags": [] } ], + "constants": [], "templates": [], "escaped": null, "rest": null, @@ -1297,9 +1278,9 @@ "maps": [] }, "value": { - "any": false, + "any": true, "required": true, - "optional": true, + "optional": false, "nullable": false, "functions": [], "atomics": [], @@ -1309,31 +1290,26 @@ "rest": null, "arrays": [], "tuples": [], - "objects": [ - { - "name": "Record", - "tags": [] - } - ], + "objects": [], "aliases": [], "natives": [], "sets": [], "maps": [] }, - "description": "List of example values as key-value pairs.", + "description": null, "jsDocTags": [] } ], - "description": "Boolean type info.", + "description": "Construct a type with a set of properties K of type T", "jsDocTags": [], - "index": 5, + "index": 4, "recursive": false, "nullables": [ false ] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.INumber", "properties": [ { "key": { @@ -1374,21 +1350,7 @@ "atomics": [ { "type": "number", - "tags": [ - [ - { - "target": "number", - "name": "Type<\"int64\">", - "kind": "type", - "value": "int64", - "validate": "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807", - "exclusive": true, - "schema": { - "type": "integer" - } - } - ] - ] + "tags": [] } ], "constants": [], @@ -1404,17 +1366,7 @@ "maps": [] }, "description": "Default value.", - "jsDocTags": [ - { - "name": "type", - "text": [ - { - "text": "int64", - "kind": "text" - } - ] - } - ] + "jsDocTags": [] }, { "key": { @@ -1455,21 +1407,7 @@ "atomics": [ { "type": "number", - "tags": [ - [ - { - "target": "number", - "name": "Type<\"int64\">", - "kind": "type", - "value": "int64", - "validate": "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807", - "exclusive": true, - "schema": { - "type": "integer" - } - } - ] - ] + "tags": [] } ], "constants": [], @@ -1485,17 +1423,7 @@ "maps": [] }, "description": "Minimum value restriction.", - "jsDocTags": [ - { - "name": "type", - "text": [ - { - "text": "int64", - "kind": "text" - } - ] - } - ] + "jsDocTags": [] }, { "key": { @@ -1536,21 +1464,7 @@ "atomics": [ { "type": "number", - "tags": [ - [ - { - "target": "number", - "name": "Type<\"int64\">", - "kind": "type", - "value": "int64", - "validate": "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807", - "exclusive": true, - "schema": { - "type": "integer" - } - } - ] - ] + "tags": [] } ], "constants": [], @@ -1566,17 +1480,7 @@ "maps": [] }, "description": "Maximum value restriction.", - "jsDocTags": [ - { - "name": "type", - "text": [ - { - "text": "int64", - "kind": "text" - } - ] - } - ] + "jsDocTags": [] }, { "key": { @@ -1632,7 +1536,7 @@ "sets": [], "maps": [] }, - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property.", + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property.", "jsDocTags": [] }, { @@ -1689,7 +1593,7 @@ "sets": [], "maps": [] }, - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property.", + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property.", "jsDocTags": [] }, { @@ -1733,17 +1637,6 @@ "type": "number", "tags": [ [ - { - "target": "number", - "name": "Type<\"uint64\">", - "kind": "type", - "value": "uint64", - "validate": "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615", - "exclusive": true, - "schema": { - "type": "integer" - } - }, { "target": "number", "name": "ExclusiveMinimum<0>", @@ -1777,15 +1670,6 @@ }, "description": "Multiple of value restriction.", "jsDocTags": [ - { - "name": "type", - "text": [ - { - "text": "uint64", - "kind": "text" - } - ] - }, { "name": "exclusiveMinimum", "text": [ @@ -1839,7 +1723,7 @@ "type": "string", "values": [ { - "value": "integer", + "value": "number", "tags": [] } ] @@ -2140,16 +2024,16 @@ "jsDocTags": [] } ], - "description": "Integer type info.", + "description": "Number (double) type info.", "jsDocTags": [], - "index": 6, + "index": 5, "recursive": false, "nullables": [ false ] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "properties": [ { "key": { @@ -2164,7 +2048,7 @@ "type": "string", "values": [ { - "value": "default", + "value": "const", "tags": [] } ] @@ -2184,13 +2068,21 @@ "value": { "any": false, "required": true, - "optional": true, + "optional": false, "nullable": false, "functions": [], "atomics": [ + { + "type": "string", + "tags": [] + }, { "type": "number", "tags": [] + }, + { + "type": "boolean", + "tags": [] } ], "constants": [], @@ -2205,7 +2097,7 @@ "sets": [], "maps": [] }, - "description": "Default value.", + "description": "The constant value.", "jsDocTags": [] }, { @@ -2221,7 +2113,7 @@ "type": "string", "values": [ { - "value": "minimum", + "value": "title", "tags": [] } ] @@ -2246,7 +2138,7 @@ "functions": [], "atomics": [ { - "type": "number", + "type": "string", "tags": [] } ], @@ -2262,7 +2154,7 @@ "sets": [], "maps": [] }, - "description": "Minimum value restriction.", + "description": "Title of the schema.", "jsDocTags": [] }, { @@ -2278,7 +2170,7 @@ "type": "string", "values": [ { - "value": "maximum", + "value": "description", "tags": [] } ] @@ -2303,7 +2195,7 @@ "functions": [], "atomics": [ { - "type": "number", + "type": "string", "tags": [] } ], @@ -2319,7 +2211,7 @@ "sets": [], "maps": [] }, - "description": "Maximum value restriction.", + "description": "Detailed description of the schema.", "jsDocTags": [] }, { @@ -2335,7 +2227,7 @@ "type": "string", "values": [ { - "value": "exclusiveMinimum", + "value": "deprecated", "tags": [] } ] @@ -2376,7 +2268,7 @@ "sets": [], "maps": [] }, - "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property.", + "description": "Whether the type is deprecated or not.", "jsDocTags": [] }, { @@ -2392,7 +2284,7 @@ "type": "string", "values": [ { - "value": "exclusiveMaximum", + "value": "example", "tags": [] } ] @@ -2410,17 +2302,12 @@ "maps": [] }, "value": { - "any": false, + "any": true, "required": true, "optional": true, "nullable": false, "functions": [], - "atomics": [ - { - "type": "boolean", - "tags": [] - } - ], + "atomics": [], "constants": [], "templates": [], "escaped": null, @@ -2433,7 +2320,7 @@ "sets": [], "maps": [] }, - "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenAiComposer}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property.", + "description": "Example value.", "jsDocTags": [] }, { @@ -2449,7 +2336,7 @@ "type": "string", "values": [ { - "value": "multipleOf", + "value": "examples", "tags": [] } ] @@ -2472,30 +2359,81 @@ "optional": true, "nullable": false, "functions": [], - "atomics": [ + "atomics": [], + "constants": [], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [ { - "type": "number", - "tags": [ - [ - { - "target": "number", - "name": "ExclusiveMinimum<0>", - "kind": "exclusiveMinimum", - "value": 0, - "validate": "0 < $input", - "exclusive": [ - "minimum", - "exclusiveMinimum" - ], - "schema": { - "exclusiveMinimum": true, - "minimum": 0 - } - } - ] + "name": "Record", + "tags": [] + } + ], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "description": "List of example values as key-value pairs.", + "jsDocTags": [] + } + ], + "description": "Constant value type.", + "jsDocTags": [], + "index": 6, + "recursive": false, + "nullables": [ + false + ] + }, + { + "name": "OpenApi.IJsonSchema.IBoolean", + "properties": [ + { + "key": { + "any": false, + "required": true, + "optional": false, + "nullable": false, + "functions": [], + "atomics": [], + "constants": [ + { + "type": "string", + "values": [ + { + "value": "default", + "tags": [] + } ] } ], + "templates": [], + "escaped": null, + "rest": null, + "arrays": [], + "tuples": [], + "objects": [], + "aliases": [], + "natives": [], + "sets": [], + "maps": [] + }, + "value": { + "any": false, + "required": true, + "optional": true, + "nullable": false, + "functions": [], + "atomics": [ + { + "type": "boolean", + "tags": [] + } + ], "constants": [], "templates": [], "escaped": null, @@ -2508,18 +2446,8 @@ "sets": [], "maps": [] }, - "description": "Multiple of value restriction.", - "jsDocTags": [ - { - "name": "exclusiveMinimum", - "text": [ - { - "text": "0", - "kind": "text" - } - ] - } - ] + "description": "The default value.", + "jsDocTags": [] }, { "key": { @@ -2563,7 +2491,7 @@ "type": "string", "values": [ { - "value": "number", + "value": "boolean", "tags": [] } ] @@ -2864,7 +2792,7 @@ "jsDocTags": [] } ], - "description": "Number (double) type info.", + "description": "Boolean type info.", "jsDocTags": [], "index": 7, "recursive": false, @@ -2873,7 +2801,7 @@ ] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "properties": [ { "key": { @@ -2913,8 +2841,22 @@ "functions": [], "atomics": [ { - "type": "string", - "tags": [] + "type": "number", + "tags": [ + [ + { + "target": "number", + "name": "Type<\"int64\">", + "kind": "type", + "value": "int64", + "validate": "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807", + "exclusive": true, + "schema": { + "type": "integer" + } + } + ] + ] } ], "constants": [], @@ -2930,7 +2872,17 @@ "maps": [] }, "description": "Default value.", - "jsDocTags": [] + "jsDocTags": [ + { + "name": "type", + "text": [ + { + "text": "int64", + "kind": "text" + } + ] + } + ] }, { "key": { @@ -2945,7 +2897,7 @@ "type": "string", "values": [ { - "value": "format", + "value": "minimum", "tags": [] } ] @@ -2970,8 +2922,22 @@ "functions": [], "atomics": [ { - "type": "string", - "tags": [] + "type": "number", + "tags": [ + [ + { + "target": "number", + "name": "Type<\"int64\">", + "kind": "type", + "value": "int64", + "validate": "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807", + "exclusive": true, + "schema": { + "type": "integer" + } + } + ] + ] } ], "constants": [], @@ -2986,8 +2952,18 @@ "sets": [], "maps": [] }, - "description": "Format restriction.", - "jsDocTags": [] + "description": "Minimum value restriction.", + "jsDocTags": [ + { + "name": "type", + "text": [ + { + "text": "int64", + "kind": "text" + } + ] + } + ] }, { "key": { @@ -3002,7 +2978,7 @@ "type": "string", "values": [ { - "value": "pattern", + "value": "maximum", "tags": [] } ] @@ -3027,8 +3003,22 @@ "functions": [], "atomics": [ { - "type": "string", - "tags": [] + "type": "number", + "tags": [ + [ + { + "target": "number", + "name": "Type<\"int64\">", + "kind": "type", + "value": "int64", + "validate": "Math.floor($input) === $input && -9223372036854775808 <= $input && $input <= 9223372036854775807", + "exclusive": true, + "schema": { + "type": "integer" + } + } + ] + ] } ], "constants": [], @@ -3043,8 +3033,18 @@ "sets": [], "maps": [] }, - "description": "Pattern restriction.", - "jsDocTags": [] + "description": "Maximum value restriction.", + "jsDocTags": [ + { + "name": "type", + "text": [ + { + "text": "int64", + "kind": "text" + } + ] + } + ] }, { "key": { @@ -3059,7 +3059,7 @@ "type": "string", "values": [ { - "value": "contentMediaType", + "value": "exclusiveMinimum", "tags": [] } ] @@ -3084,7 +3084,7 @@ "functions": [], "atomics": [ { - "type": "string", + "type": "boolean", "tags": [] } ], @@ -3100,7 +3100,7 @@ "sets": [], "maps": [] }, - "description": "Content media type restriction.", + "description": "Exclusive minimum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMinimum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link minimum} property.", "jsDocTags": [] }, { @@ -3116,7 +3116,7 @@ "type": "string", "values": [ { - "value": "minLength", + "value": "exclusiveMaximum", "tags": [] } ] @@ -3141,22 +3141,8 @@ "functions": [], "atomics": [ { - "type": "number", - "tags": [ - [ - { - "target": "number", - "name": "Type<\"uint64\">", - "kind": "type", - "value": "uint64", - "validate": "Math.floor($input) === $input && 0 <= $input && $input <= 18446744073709551615", - "exclusive": true, - "schema": { - "type": "integer" - } - } - ] - ] + "type": "boolean", + "tags": [] } ], "constants": [], @@ -3171,18 +3157,8 @@ "sets": [], "maps": [] }, - "description": "Minimum length restriction.", - "jsDocTags": [ - { - "name": "type", - "text": [ - { - "text": "uint64", - "kind": "text" - } - ] - } - ] + "description": "Exclusive maximum value restriction.\n\nFor reference, even though your Swagger (or OpenAPI) document has\ndefined the `exclusiveMaximum` value as `number`, {@link OpenApi}\nforcibly converts it to `boolean` type, and assign the numeric value to\nthe {@link maximum} property.", + "jsDocTags": [] }, { "key": { @@ -3197,7 +3173,7 @@ "type": "string", "values": [ { - "value": "maxLength", + "value": "multipleOf", "tags": [] } ] @@ -3235,6 +3211,21 @@ "schema": { "type": "integer" } + }, + { + "target": "number", + "name": "ExclusiveMinimum<0>", + "kind": "exclusiveMinimum", + "value": 0, + "validate": "0 < $input", + "exclusive": [ + "minimum", + "exclusiveMinimum" + ], + "schema": { + "exclusiveMinimum": true, + "minimum": 0 + } } ] ] @@ -3252,7 +3243,7 @@ "sets": [], "maps": [] }, - "description": "Maximum length restriction.", + "description": "Multiple of value restriction.", "jsDocTags": [ { "name": "type", @@ -3262,6 +3253,15 @@ "kind": "text" } ] + }, + { + "name": "exclusiveMinimum", + "text": [ + { + "text": "0", + "kind": "text" + } + ] } ] }, @@ -3307,7 +3307,7 @@ "type": "string", "values": [ { - "value": "string", + "value": "integer", "tags": [] } ] @@ -3608,7 +3608,7 @@ "jsDocTags": [] } ], - "description": "String type info.", + "description": "Integer type info.", "jsDocTags": [], "index": 8, "recursive": false, @@ -3664,23 +3664,23 @@ "tuples": [], "objects": [ { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IBoolean", + "name": "OpenApi.IJsonSchema.INumber", "tags": [] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.IBoolean", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "tags": [] }, { @@ -4400,23 +4400,23 @@ "tuples": [], "objects": [ { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IBoolean", + "name": "OpenApi.IJsonSchema.INumber", "tags": [] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.IBoolean", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "tags": [] }, { @@ -5136,23 +5136,23 @@ "tuples": [], "objects": [ { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IBoolean", + "name": "OpenApi.IJsonSchema.INumber", "tags": [] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.IBoolean", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "tags": [] }, { @@ -5995,7 +5995,7 @@ "rest": null, "arrays": [ { - "name": "Array | ITuple | IObject<...> | IReference<...> | INull | IUnknown>", + "name": "Array | ITuple | IObject<...> | IReference<...> | INull | IUnknown>", "tags": [] } ], @@ -9347,23 +9347,23 @@ "tuples": [], "objects": [ { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IBoolean", + "name": "OpenApi.IJsonSchema.INumber", "tags": [] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.IBoolean", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "tags": [] }, { @@ -9407,7 +9407,7 @@ "index": null }, { - "name": "Array | ITuple | IObject<...> | IReference<...> | INull | IUnknown>", + "name": "Array | ITuple | IObject<...> | IReference<...> | INull | IUnknown>", "value": { "any": false, "required": true, @@ -9423,23 +9423,23 @@ "tuples": [], "objects": [ { - "name": "OpenApi.IJsonSchema.IConstant", + "name": "OpenApi.IJsonSchema.IString", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IBoolean", + "name": "OpenApi.IJsonSchema.INumber", "tags": [] }, { - "name": "OpenApi.IJsonSchema.INumber", + "name": "OpenApi.IJsonSchema.IConstant", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IInteger", + "name": "OpenApi.IJsonSchema.IBoolean", "tags": [] }, { - "name": "OpenApi.IJsonSchema.IString", + "name": "OpenApi.IJsonSchema.IInteger", "tags": [] }, { diff --git a/test/src/debug/schema.ts b/test/src/debug/schema.ts index 7753f47f51..cd5492ba0b 100644 --- a/test/src/debug/schema.ts +++ b/test/src/debug/schema.ts @@ -1,6 +1,9 @@ -import typia from "typia"; +import typia, { tags } from "typia"; -import { UltimateUnion } from "../structures/UltimateUnion"; +typia.llm.schema(); -const schema = typia.llm.schema(); -console.log(JSON.stringify(schema, null, 2)); +interface IDepartment { + id: string & tags.Format<"uuid">; + name: string; + department: IDepartment[]; +}