File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ export class GraphQLSchema {
88
88
// Used as a cache for validateSchema().
89
89
__validationErrors : ?$ReadOnlyArray < GraphQLError > ;
90
90
// Referenced by validateSchema().
91
- __allowedLegacyNames : ? $ReadOnlyArray < string > ;
91
+ __allowedLegacyNames : $ReadOnlyArray < string > ;
92
92
93
93
constructor ( config : GraphQLSchemaConfig ) : void {
94
94
// If this schema was built from a source known to be valid, then it may be
@@ -118,7 +118,7 @@ export class GraphQLSchema {
118
118
) ;
119
119
}
120
120
121
- this . __allowedLegacyNames = config . allowedLegacyNames ;
121
+ this . __allowedLegacyNames = config . allowedLegacyNames || [ ] ;
122
122
this . _queryType = config . query ;
123
123
this . _mutationType = config . mutation ;
124
124
this . _subscriptionType = config . subscription ;
Original file line number Diff line number Diff line change @@ -221,10 +221,7 @@ function validateName(
221
221
) : void {
222
222
// If a schema explicitly allows some legacy name which is no longer valid,
223
223
// allow it to be assumed valid.
224
- if (
225
- context . schema . __allowedLegacyNames &&
226
- context . schema . __allowedLegacyNames . indexOf ( node . name ) !== - 1
227
- ) {
224
+ if ( context . schema . __allowedLegacyNames . indexOf ( node . name ) !== - 1 ) {
228
225
return ;
229
226
}
230
227
// Ensure names are valid, however introspection types opt out.
Original file line number Diff line number Diff line change @@ -237,12 +237,9 @@ export function extendSchema(
237
237
] ;
238
238
239
239
// Support both original legacy names and extended legacy names.
240
- const schemaAllowedLegacyNames = schema . __allowedLegacyNames ;
241
- const extendAllowedLegacyNames = options && options . allowedLegacyNames ;
242
- const allowedLegacyNames =
243
- schemaAllowedLegacyNames && extendAllowedLegacyNames
244
- ? schemaAllowedLegacyNames . concat ( extendAllowedLegacyNames )
245
- : schemaAllowedLegacyNames || extendAllowedLegacyNames ;
240
+ const allowedLegacyNames = schema . __allowedLegacyNames . concat (
241
+ ( options && options . allowedLegacyNames ) || [ ] ,
242
+ ) ;
246
243
247
244
// Then produce and return a Schema with these types.
248
245
return new GraphQLSchema ( {
You can’t perform that action at this time.
0 commit comments