diff --git a/package.json b/package.json index 16c9e38e52..0f65cb06c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typia", - "version": "5.2.1", + "version": "5.2.2-dev.20231012", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/packages/typescript-json/package.json b/packages/typescript-json/package.json index 5f36ec5148..4f63fae71c 100644 --- a/packages/typescript-json/package.json +++ b/packages/typescript-json/package.json @@ -1,6 +1,6 @@ { "name": "typescript-json", - "version": "5.2.1", + "version": "5.2.2-dev.20231012", "description": "Superfast runtime validators with only one line", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -72,7 +72,7 @@ }, "homepage": "https://typia.io", "dependencies": { - "typia": "5.2.1-dev.20231011" + "typia": "5.2.2-dev.20231012" }, "peerDependencies": { "typescript": ">= 4.8.0" diff --git a/src/factories/MetadataCollection.ts b/src/factories/MetadataCollection.ts index 2f61d0773d..a8c7b011b6 100644 --- a/src/factories/MetadataCollection.ts +++ b/src/factories/MetadataCollection.ts @@ -117,9 +117,14 @@ export class MetadataCollection { name: $id, properties: [], description: + (type.aliasSymbol && + CommentFactory.description(type.aliasSymbol)) ?? (type.symbol && CommentFactory.description(type.symbol)) ?? undefined, - jsDocTags: type.symbol?.getJsDocTags() ?? [], + jsDocTags: + type.aliasSymbol?.getJsDocTags() ?? + type.symbol?.getJsDocTags() ?? + [], validated: false, index: this.object_index_++, recursive: null!, diff --git a/test/generated/output/issues/test_issue_831_optional.ts b/test/generated/output/issues/test_issue_831_optional.ts index bc9e11fb1c..9efb6c1c90 100644 --- a/test/generated/output/issues/test_issue_831_optional.ts +++ b/test/generated/output/issues/test_issue_831_optional.ts @@ -75,6 +75,7 @@ export const test_issue_831_optional = () => { }, }, nullable: false, + description: "Make all properties in T optional", "x-typia-jsDocTags": [], }, RequiredIQuery: { @@ -103,6 +104,7 @@ export const test_issue_831_optional = () => { }, nullable: false, required: ["required", "optional"], + description: "Make all properties in T required", "x-typia-jsDocTags": [], }, }, diff --git a/test/issues/swagger.ts b/test/issues/swagger.ts index 0b827237ef..aed36d2988 100644 --- a/test/issues/swagger.ts +++ b/test/issues/swagger.ts @@ -1,17 +1,31 @@ -import typia, { IJsonApplication, IJsonComponents } from "typia"; +import typia from "typia"; -interface IQuery { - nonRequired: string | undefined; +/** + * Some description. + * + * @title something + */ +interface Interface { + value: number; } -const app: IJsonApplication = typia.json.application<[Partial]>(); -const query: IJsonComponents.IObject = app.components.schemas - ?.PartialIQuery as IJsonComponents.IObject; +/** + * Some description. + * + * @title something + */ +interface Type { + value: number; +} -console.log( - Object.entries(query.properties).map(([key, value]) => [ - key, - value["x-typia-required"], - value["x-typia-optional"], - ]), -); +const app = typia.json.application<[Interface, Type]>(); +console.log({ + interface: { + description: app.components.schemas?.Interface?.description, + tags: app.components.schemas?.Interface?.["x-typia-jsDocTags"], + }, + type: { + description: app.components.schemas?.Type?.description, + tags: app.components.schemas?.Type?.["x-typia-jsDocTags"], + }, +}); diff --git a/test/schemas/json/ajv/DynamicTree.json b/test/schemas/json/ajv/DynamicTree.json index f01f9f0dc2..27acd7202f 100644 --- a/test/schemas/json/ajv/DynamicTree.json +++ b/test/schemas/json/ajv/DynamicTree.json @@ -35,6 +35,7 @@ "$id": "#/components/schemas/RecordstringDynamicTree", "type": "object", "properties": {}, + "description": "Construct a type with a set of properties K of type T", "x-typia-jsDocTags": [], "additionalProperties": { "$ref": "#/components/schemas/DynamicTree" diff --git a/test/schemas/json/ajv/ObjectPartial.json b/test/schemas/json/ajv/ObjectPartial.json index 81f620f6d0..f579d5c68a 100644 --- a/test/schemas/json/ajv/ObjectPartial.json +++ b/test/schemas/json/ajv/ObjectPartial.json @@ -50,6 +50,7 @@ "x-typia-optional": true } }, + "description": "Make all properties in T optional", "x-typia-jsDocTags": [] }, "ObjectPartial.IBase": { diff --git a/test/schemas/json/ajv/ObjectRequired.json b/test/schemas/json/ajv/ObjectRequired.json index 0f935cdc45..64a271a9ad 100644 --- a/test/schemas/json/ajv/ObjectRequired.json +++ b/test/schemas/json/ajv/ObjectRequired.json @@ -57,6 +57,7 @@ "array", "object" ], + "description": "Make all properties in T required", "x-typia-jsDocTags": [] }, "ObjectRequired.IBase": { diff --git a/test/schemas/json/ajv/UltimateUnion.json b/test/schemas/json/ajv/UltimateUnion.json index 4a7b3689cb..4afe31bbcc 100644 --- a/test/schemas/json/ajv/UltimateUnion.json +++ b/test/schemas/json/ajv/UltimateUnion.json @@ -1278,6 +1278,7 @@ "$id": "#/components/schemas/RecordstringIObjectIAlias", "type": "object", "properties": {}, + "description": "Construct a type with a set of properties K of type T", "x-typia-jsDocTags": [], "additionalProperties": { "oneOf": [ @@ -1484,6 +1485,7 @@ "$id": "#/components/schemas/RecordstringIJsonSchema", "type": "object", "properties": {}, + "description": "Construct a type with a set of properties K of type T", "x-typia-jsDocTags": [], "additionalProperties": { "$ref": "#/components/schemas/IJsonSchema" diff --git a/test/schemas/json/swagger/DynamicTree.json b/test/schemas/json/swagger/DynamicTree.json index f7597401c2..aa4344a9e0 100644 --- a/test/schemas/json/swagger/DynamicTree.json +++ b/test/schemas/json/swagger/DynamicTree.json @@ -35,6 +35,7 @@ "type": "object", "properties": {}, "nullable": false, + "description": "Construct a type with a set of properties K of type T", "x-typia-jsDocTags": [], "x-typia-additionalProperties": { "$ref": "#/components/schemas/DynamicTree" diff --git a/test/schemas/json/swagger/ObjectPartial.json b/test/schemas/json/swagger/ObjectPartial.json index ea68b78bba..863f567421 100644 --- a/test/schemas/json/swagger/ObjectPartial.json +++ b/test/schemas/json/swagger/ObjectPartial.json @@ -39,6 +39,7 @@ } }, "nullable": false, + "description": "Make all properties in T optional", "x-typia-jsDocTags": [] }, "ObjectPartial.IBase.Nullable": { diff --git a/test/schemas/json/swagger/ObjectRequired.json b/test/schemas/json/swagger/ObjectRequired.json index 277b3e6769..3dc800108a 100644 --- a/test/schemas/json/swagger/ObjectRequired.json +++ b/test/schemas/json/swagger/ObjectRequired.json @@ -46,6 +46,7 @@ "array", "object" ], + "description": "Make all properties in T required", "x-typia-jsDocTags": [] }, "ObjectRequired.IBase.Nullable": { diff --git a/test/schemas/json/swagger/UltimateUnion.json b/test/schemas/json/swagger/UltimateUnion.json index 431ed992c8..f02e76cfba 100644 --- a/test/schemas/json/swagger/UltimateUnion.json +++ b/test/schemas/json/swagger/UltimateUnion.json @@ -1276,6 +1276,7 @@ "type": "object", "properties": {}, "nullable": false, + "description": "Construct a type with a set of properties K of type T", "x-typia-jsDocTags": [], "x-typia-additionalProperties": { "oneOf": [ @@ -1530,6 +1531,7 @@ "type": "object", "properties": {}, "nullable": false, + "description": "Construct a type with a set of properties K of type T", "x-typia-jsDocTags": [], "x-typia-additionalProperties": { "$ref": "#/components/schemas/IJsonSchema"