Skip to content

Commit 32e18a4

Browse files
ExcitedSpiderqefeng
and
qefeng
authored
fix: top-level alias type comments parse (YousefED#395)
Co-authored-by: qefeng <[email protected]>
1 parent 8fcba63 commit 32e18a4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Diff for: test/programs/type-aliases-partial/schema.json

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"definitions": {
1616
"__type": {
1717
"type": "object",
18+
"description": "Make all properties in T optional",
1819
"properties": {
1920
"x": {
2021
"type": "number"
@@ -29,6 +30,7 @@
2930
},
3031
"__type_1": {
3132
"type": "object",
33+
"description": "Make all properties in T optional",
3234
"properties": {
3335
"a": {
3436
"type": "number"

Diff for: test/programs/type-recursive/schema.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
},
2323
"type": "array"
2424
}
25-
]
25+
],
26+
"description": "A recursive type"
2627
}
27-
}
28+
},
29+
"description": "A recursive type"
2830
}

Diff for: typescript-json-schema.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,7 @@ export class JsonSchemaGenerator {
11971197
const otherAnnotations = {};
11981198
this.parseCommentsIntoDefinition(reffedType!, definition, otherAnnotations); // handle comments in the type alias declaration
11991199
this.parseCommentsIntoDefinition(symbol!, definition, otherAnnotations);
1200+
this.parseCommentsIntoDefinition(typ.aliasSymbol!, definition, otherAnnotations);
12001201
if (prop) {
12011202
this.parseCommentsIntoDefinition(prop, returnedDefinition, otherAnnotations);
12021203
}

0 commit comments

Comments
 (0)