From d3438168e5a0e0b0fe15585f678ea277d9df607e Mon Sep 17 00:00:00 2001 From: qefeng Date: Tue, 22 Dec 2020 17:36:20 +0800 Subject: [PATCH 1/2] fix: alias type comments parse --- typescript-json-schema.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/typescript-json-schema.ts b/typescript-json-schema.ts index c9ca9d8d..92742981 100644 --- a/typescript-json-schema.ts +++ b/typescript-json-schema.ts @@ -1197,6 +1197,7 @@ export class JsonSchemaGenerator { const otherAnnotations = {}; this.parseCommentsIntoDefinition(reffedType!, definition, otherAnnotations); // handle comments in the type alias declaration this.parseCommentsIntoDefinition(symbol!, definition, otherAnnotations); + this.parseCommentsIntoDefinition(typ.aliasSymbol!, definition, otherAnnotations); if (prop) { this.parseCommentsIntoDefinition(prop, returnedDefinition, otherAnnotations); } From e05889cd135de5b3864f39788475915840b8e697 Mon Sep 17 00:00:00 2001 From: qefeng Date: Wed, 23 Dec 2020 10:48:31 +0800 Subject: [PATCH 2/2] test: correcting existing tests --- test/programs/type-aliases-partial/schema.json | 2 ++ test/programs/type-recursive/schema.json | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/programs/type-aliases-partial/schema.json b/test/programs/type-aliases-partial/schema.json index 71cd3457..de8e7901 100644 --- a/test/programs/type-aliases-partial/schema.json +++ b/test/programs/type-aliases-partial/schema.json @@ -15,6 +15,7 @@ "definitions": { "__type": { "type": "object", + "description": "Make all properties in T optional", "properties": { "x": { "type": "number" @@ -29,6 +30,7 @@ }, "__type_1": { "type": "object", + "description": "Make all properties in T optional", "properties": { "a": { "type": "number" diff --git a/test/programs/type-recursive/schema.json b/test/programs/type-recursive/schema.json index dd0ee49f..d2a59a30 100644 --- a/test/programs/type-recursive/schema.json +++ b/test/programs/type-recursive/schema.json @@ -22,7 +22,9 @@ }, "type": "array" } - ] + ], + "description": "A recursive type" } - } + }, + "description": "A recursive type" }