File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
test/programs/annotation-tjs Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 11// 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+
25interface MyObject {
36 /**
47 * @TJS -format date-time
@@ -51,7 +54,7 @@ interface MyObject {
5154 regexPattern : string ;
5255
5356 /**
54- * @TJS -pattern ^[a-zA-Z0-9]{4}-abc_123$
57+ * @TJS -pattern ^[a-zA-Z0-9]{4}-abc_123$
5558 */
5659 regexPatternWithWhitespace : string ;
5760
@@ -79,4 +82,9 @@ interface MyObject {
7982 * @TJS -hide false
8083 */
8184 booleanAnnotationWithFalse : string ;
85+
86+ /**
87+ * @TJS -ignore
88+ */
89+ complexWithRefIgnored : MyRef ;
8290}
Original file line number Diff line number Diff line change @@ -1089,6 +1089,16 @@ export class JsonSchemaGenerator {
10891089
10901090 let returnedDefinition = definition ; // returned definition, may be a $ref
10911091
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+
10921102 const symbol = typ . getSymbol ( ) ;
10931103 // FIXME: We can't just compare the name of the symbol - it ignores the namespace
10941104 const isRawType =
@@ -1176,7 +1186,6 @@ export class JsonSchemaGenerator {
11761186 if ( prop ) {
11771187 this . parseCommentsIntoDefinition ( prop , returnedDefinition , otherAnnotations ) ;
11781188 }
1179-
11801189 // Create the actual definition only if is an inline definition, or
11811190 // if it will be a $ref and it is not yet created
11821191 if ( ! asRef || ! this . reffedDefinitions [ fullTypeName ] ) {
You can’t perform that action at this time.
0 commit comments