@@ -84,10 +84,17 @@ export const __Directive = new GraphQLObjectType({
84
84
'conditionally including or skipping a field. Directives provide this by ' +
85
85
'describing additional information to the executor.' ,
86
86
fields : ( ) => ( {
87
- name : { type : GraphQLNonNull ( GraphQLString ) } ,
88
- description : { type : GraphQLString } ,
87
+ name : {
88
+ type : GraphQLNonNull ( GraphQLString ) ,
89
+ resolve : obj => obj . name ,
90
+ } ,
91
+ description : {
92
+ type : GraphQLString ,
93
+ resolve : obj => obj . description ,
94
+ } ,
89
95
locations : {
90
96
type : GraphQLNonNull ( GraphQLList ( GraphQLNonNull ( __DirectiveLocation ) ) ) ,
97
+ resolve : obj => obj . locations ,
91
98
} ,
92
99
args : {
93
100
type : GraphQLNonNull ( GraphQLList ( GraphQLNonNull ( __InputValue ) ) ) ,
@@ -237,8 +244,14 @@ export const __Type = new GraphQLObjectType({
237
244
throw new Error ( 'Unknown kind of type: ' + type ) ;
238
245
} ,
239
246
} ,
240
- name : { type : GraphQLString } ,
241
- description : { type : GraphQLString } ,
247
+ name : {
248
+ type : GraphQLString ,
249
+ resolve : obj => obj . name ,
250
+ } ,
251
+ description : {
252
+ type : GraphQLString ,
253
+ resolve : obj => obj . description ,
254
+ } ,
242
255
fields : {
243
256
type : GraphQLList ( GraphQLNonNull ( __Field ) ) ,
244
257
args : {
@@ -294,7 +307,10 @@ export const __Type = new GraphQLObjectType({
294
307
}
295
308
} ,
296
309
} ,
297
- ofType : { type : __Type } ,
310
+ ofType : {
311
+ type : __Type ,
312
+ resolve : obj => obj . ofType ,
313
+ } ,
298
314
} ) ,
299
315
} ) ;
300
316
@@ -305,16 +321,29 @@ export const __Field = new GraphQLObjectType({
305
321
'Object and Interface types are described by a list of Fields, each of ' +
306
322
'which has a name, potentially a list of arguments, and a return type.' ,
307
323
fields : ( ) => ( {
308
- name : { type : GraphQLNonNull ( GraphQLString ) } ,
309
- description : { type : GraphQLString } ,
324
+ name : {
325
+ type : GraphQLNonNull ( GraphQLString ) ,
326
+ resolve : obj => obj . name ,
327
+ } ,
328
+ description : {
329
+ type : GraphQLString ,
330
+ resolve : obj => obj . description ,
331
+ } ,
310
332
args : {
311
333
type : GraphQLNonNull ( GraphQLList ( GraphQLNonNull ( __InputValue ) ) ) ,
312
334
resolve : field => field . args || [ ] ,
313
335
} ,
314
- type : { type : GraphQLNonNull ( __Type ) } ,
315
- isDeprecated : { type : GraphQLNonNull ( GraphQLBoolean ) } ,
336
+ type : {
337
+ type : GraphQLNonNull ( __Type ) ,
338
+ resolve : obj => obj . type ,
339
+ } ,
340
+ isDeprecated : {
341
+ type : GraphQLNonNull ( GraphQLBoolean ) ,
342
+ resolve : obj => obj . isDeprecated ,
343
+ } ,
316
344
deprecationReason : {
317
345
type : GraphQLString ,
346
+ resolve : obj => obj . deprecationReason ,
318
347
} ,
319
348
} ) ,
320
349
} ) ;
@@ -327,9 +356,18 @@ export const __InputValue = new GraphQLObjectType({
327
356
'InputObject are represented as Input Values which describe their type ' +
328
357
'and optionally a default value.' ,
329
358
fields : ( ) => ( {
330
- name : { type : GraphQLNonNull ( GraphQLString ) } ,
331
- description : { type : GraphQLString } ,
332
- type : { type : GraphQLNonNull ( __Type ) } ,
359
+ name : {
360
+ type : GraphQLNonNull ( GraphQLString ) ,
361
+ resolve : obj => obj . name ,
362
+ } ,
363
+ description : {
364
+ type : GraphQLString ,
365
+ resolve : obj => obj . description ,
366
+ } ,
367
+ type : {
368
+ type : GraphQLNonNull ( __Type ) ,
369
+ resolve : obj => obj . type ,
370
+ } ,
333
371
defaultValue : {
334
372
type : GraphQLString ,
335
373
description :
@@ -351,11 +389,21 @@ export const __EnumValue = new GraphQLObjectType({
351
389
'a placeholder for a string or numeric value. However an Enum value is ' +
352
390
'returned in a JSON response as a string.' ,
353
391
fields : ( ) => ( {
354
- name : { type : GraphQLNonNull ( GraphQLString ) } ,
355
- description : { type : GraphQLString } ,
356
- isDeprecated : { type : GraphQLNonNull ( GraphQLBoolean ) } ,
392
+ name : {
393
+ type : GraphQLNonNull ( GraphQLString ) ,
394
+ resolve : obj => obj . name ,
395
+ } ,
396
+ description : {
397
+ type : GraphQLString ,
398
+ resolve : obj => obj . description ,
399
+ } ,
400
+ isDeprecated : {
401
+ type : GraphQLNonNull ( GraphQLBoolean ) ,
402
+ resolve : obj => obj . isDeprecated ,
403
+ } ,
357
404
deprecationReason : {
358
405
type : GraphQLString ,
406
+ resolve : obj => obj . deprecationReason ,
359
407
} ,
360
408
} ) ,
361
409
} ) ;
0 commit comments