Skip to content

Commit d680d07

Browse files
introspection: use consistent naming for 'resolve' args (#2418)
1 parent 9d9f606 commit d680d07

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

src/type/introspection.js

+23-22
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ export const __Directive = new GraphQLObjectType({
8383
({
8484
name: {
8585
type: GraphQLNonNull(GraphQLString),
86-
resolve: obj => obj.name,
86+
resolve: directive => directive.name,
8787
},
8888
description: {
8989
type: GraphQLString,
90-
resolve: obj => obj.description,
90+
resolve: directive => directive.description,
9191
},
9292
isRepeatable: {
9393
type: GraphQLNonNull(GraphQLBoolean),
94-
resolve: obj => obj.isRepeatable,
94+
resolve: directive => directive.isRepeatable,
9595
},
9696
locations: {
9797
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(__DirectiveLocation))),
98-
resolve: obj => obj.locations,
98+
resolve: directive => directive.locations,
9999
},
100100
args: {
101101
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
@@ -228,12 +228,12 @@ export const __Type = new GraphQLObjectType({
228228
},
229229
name: {
230230
type: GraphQLString,
231-
resolve: obj => (obj.name !== undefined ? obj.name : undefined),
231+
resolve: type => (type.name !== undefined ? type.name : undefined),
232232
},
233233
description: {
234234
type: GraphQLString,
235-
resolve: obj =>
236-
obj.description !== undefined ? obj.description : undefined,
235+
resolve: type =>
236+
type.description !== undefined ? type.description : undefined,
237237
},
238238
fields: {
239239
type: GraphQLList(GraphQLNonNull(__Field)),
@@ -292,7 +292,7 @@ export const __Type = new GraphQLObjectType({
292292
},
293293
ofType: {
294294
type: __Type,
295-
resolve: obj => (obj.ofType !== undefined ? obj.ofType : undefined),
295+
resolve: type => (type.ofType !== undefined ? type.ofType : undefined),
296296
},
297297
}: GraphQLFieldConfigMap<GraphQLType, mixed>),
298298
});
@@ -305,27 +305,27 @@ export const __Field = new GraphQLObjectType({
305305
({
306306
name: {
307307
type: GraphQLNonNull(GraphQLString),
308-
resolve: obj => obj.name,
308+
resolve: field => field.name,
309309
},
310310
description: {
311311
type: GraphQLString,
312-
resolve: obj => obj.description,
312+
resolve: field => field.description,
313313
},
314314
args: {
315315
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
316316
resolve: field => field.args,
317317
},
318318
type: {
319319
type: GraphQLNonNull(__Type),
320-
resolve: obj => obj.type,
320+
resolve: field => field.type,
321321
},
322322
isDeprecated: {
323323
type: GraphQLNonNull(GraphQLBoolean),
324-
resolve: obj => obj.isDeprecated,
324+
resolve: field => field.isDeprecated,
325325
},
326326
deprecationReason: {
327327
type: GraphQLString,
328-
resolve: obj => obj.deprecationReason,
328+
resolve: field => field.deprecationReason,
329329
},
330330
}: GraphQLFieldConfigMap<GraphQLField<mixed, mixed>, mixed>),
331331
});
@@ -338,22 +338,23 @@ export const __InputValue = new GraphQLObjectType({
338338
({
339339
name: {
340340
type: GraphQLNonNull(GraphQLString),
341-
resolve: obj => obj.name,
341+
resolve: inputValue => inputValue.name,
342342
},
343343
description: {
344344
type: GraphQLString,
345-
resolve: obj => obj.description,
345+
resolve: inputValue => inputValue.description,
346346
},
347347
type: {
348348
type: GraphQLNonNull(__Type),
349-
resolve: obj => obj.type,
349+
resolve: inputValue => inputValue.type,
350350
},
351351
defaultValue: {
352352
type: GraphQLString,
353353
description:
354354
'A GraphQL-formatted string representing the default value for this input value.',
355-
resolve(inputVal) {
356-
const valueAST = astFromValue(inputVal.defaultValue, inputVal.type);
355+
resolve(inputValue) {
356+
const { type, defaultValue } = inputValue;
357+
const valueAST = astFromValue(defaultValue, type);
357358
return valueAST ? print(valueAST) : null;
358359
},
359360
},
@@ -368,19 +369,19 @@ export const __EnumValue = new GraphQLObjectType({
368369
({
369370
name: {
370371
type: GraphQLNonNull(GraphQLString),
371-
resolve: obj => obj.name,
372+
resolve: enumValue => enumValue.name,
372373
},
373374
description: {
374375
type: GraphQLString,
375-
resolve: obj => obj.description,
376+
resolve: enumValue => enumValue.description,
376377
},
377378
isDeprecated: {
378379
type: GraphQLNonNull(GraphQLBoolean),
379-
resolve: obj => obj.isDeprecated,
380+
resolve: enumValue => enumValue.isDeprecated,
380381
},
381382
deprecationReason: {
382383
type: GraphQLString,
383-
resolve: obj => obj.deprecationReason,
384+
resolve: enumValue => enumValue.deprecationReason,
384385
},
385386
}: GraphQLFieldConfigMap<GraphQLEnumValue, mixed>),
386387
});

0 commit comments

Comments
 (0)