File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -80,16 +80,18 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
80
80
return optionsWithDefault . inputValueDeprecation ? str : '' ;
81
81
}
82
82
const oneOf = optionsWithDefault . oneOf ? 'isOneOf' : '' ;
83
- function ofType ( level = 9 ) : string {
83
+ function ofType ( level : number , indent : string ) : string {
84
84
if ( level <= 0 ) {
85
85
return '' ;
86
86
}
87
+ if ( level > 100 ) {
88
+ throw new Error ( "Please set typeDepth to a reasonable value; the default is 9." ) ;
89
+ }
87
90
return `
88
- ofType {
89
- name
90
- kind
91
- ${ ofType ( level - 1 ) }
92
- }` ;
91
+ ${ indent } ofType {
92
+ ${ indent } name
93
+ ${ indent } kind${ ofType ( level - 1 , indent + " " ) }
94
+ ${ indent } }`;
93
95
}
94
96
95
97
return `
@@ -160,8 +162,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
160
162
161
163
fragment TypeRef on __Type {
162
164
kind
163
- name
164
- ${ ofType ( optionsWithDefault . typeDepth ) }
165
+ name${ ofType ( optionsWithDefault . typeDepth ?? 9 , " " ) }
165
166
}
166
167
` ;
167
168
}
You can’t perform that action at this time.
0 commit comments