File tree 3 files changed +6
-12
lines changed
3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ export class GraphQLSchema {
89
89
// Used as a cache for validateSchema().
90
90
__validationErrors : ?$ReadOnlyArray < GraphQLError > ;
91
91
// Referenced by validateSchema().
92
- __allowedLegacyNames : ? $ReadOnlyArray < string > ;
92
+ __allowedLegacyNames : $ReadOnlyArray < string > ;
93
93
94
94
constructor ( config : GraphQLSchemaConfig ) : void {
95
95
// If this schema was built from a source known to be valid, then it may be
@@ -119,7 +119,7 @@ export class GraphQLSchema {
119
119
) ;
120
120
}
121
121
122
- this . __allowedLegacyNames = config . allowedLegacyNames ;
122
+ this . __allowedLegacyNames = config . allowedLegacyNames || [ ] ;
123
123
this . _queryType = config . query ;
124
124
this . _mutationType = config . mutation ;
125
125
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