File tree 2 files changed +19
-2
lines changed
test/programs/annotation-tjs
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
// All of these formats are defined in this specification: http://json-schema.org/latest/json-schema-validation.html#rfc.section.8.3
2
+
3
+ interface MyRef { }
4
+
2
5
interface MyObject {
3
6
/**
4
7
* @TJS -format date-time
@@ -51,7 +54,7 @@ interface MyObject {
51
54
regexPattern : string ;
52
55
53
56
/**
54
- * @TJS -pattern ^[a-zA-Z0-9]{4}-abc_123$
57
+ * @TJS -pattern ^[a-zA-Z0-9]{4}-abc_123$
55
58
*/
56
59
regexPatternWithWhitespace : string ;
57
60
@@ -79,4 +82,9 @@ interface MyObject {
79
82
* @TJS -hide false
80
83
*/
81
84
booleanAnnotationWithFalse : string ;
85
+
86
+ /**
87
+ * @TJS -ignore
88
+ */
89
+ complexWithRefIgnored : MyRef ;
82
90
}
Original file line number Diff line number Diff line change @@ -1089,6 +1089,16 @@ export class JsonSchemaGenerator {
1089
1089
1090
1090
let returnedDefinition = definition ; // returned definition, may be a $ref
1091
1091
1092
+ // Parse property comments now to skip recursive if ignore.
1093
+ if ( prop ) {
1094
+ const defs = { } ;
1095
+ const others = { } ;
1096
+ this . parseCommentsIntoDefinition ( prop , defs , others ) ;
1097
+ if ( defs . hasOwnProperty ( "ignore" ) ) {
1098
+ return defs ;
1099
+ }
1100
+ }
1101
+
1092
1102
const symbol = typ . getSymbol ( ) ;
1093
1103
// FIXME: We can't just compare the name of the symbol - it ignores the namespace
1094
1104
const isRawType =
@@ -1176,7 +1186,6 @@ export class JsonSchemaGenerator {
1176
1186
if ( prop ) {
1177
1187
this . parseCommentsIntoDefinition ( prop , returnedDefinition , otherAnnotations ) ;
1178
1188
}
1179
-
1180
1189
// Create the actual definition only if is an inline definition, or
1181
1190
// if it will be a $ref and it is not yet created
1182
1191
if ( ! asRef || ! this . reffedDefinitions [ fullTypeName ] ) {
You can’t perform that action at this time.
0 commit comments