@@ -410,15 +410,16 @@ function defineFieldMap(
410
410
fieldNames . forEach ( fieldName => {
411
411
assertValidName ( fieldName ) ;
412
412
const fieldConfig = fieldMap [ fieldName ] ;
413
- const field = {
414
- ...fieldConfig ,
415
- name : fieldName
416
- } ;
417
413
invariant (
418
- ! field . hasOwnProperty ( 'isDeprecated' ) ,
414
+ ! fieldConfig . hasOwnProperty ( 'isDeprecated' ) ,
419
415
`${ type . name } .${ fieldName } should provide "deprecationReason" instead ` +
420
416
'of "isDeprecated".'
421
417
) ;
418
+ const field = {
419
+ ...fieldConfig ,
420
+ isDeprecated : Boolean ( fieldConfig . deprecationReason ) ,
421
+ name : fieldName
422
+ } ;
422
423
invariant (
423
424
isOutputType ( field . type ) ,
424
425
`${ type . name } .${ fieldName } field type must be Output Type but ` +
@@ -526,6 +527,7 @@ export type GraphQLFieldDefinition = {
526
527
type : GraphQLOutputType ;
527
528
args : Array < GraphQLArgument > ;
528
529
resolve ?: GraphQLFieldResolveFn < * > ;
530
+ isDeprecated ?: boolean ;
529
531
deprecationReason ?: ?string ;
530
532
} ;
531
533
@@ -831,6 +833,7 @@ function defineEnumValues(
831
833
return {
832
834
name : valueName ,
833
835
description : value . description ,
836
+ isDeprecated : Boolean ( value . deprecationReason ) ,
834
837
deprecationReason : value . deprecationReason ,
835
838
value : isNullish ( value . value ) ? valueName : value . value ,
836
839
} ;
@@ -856,6 +859,7 @@ export type GraphQLEnumValueConfig/* <T> */ = {
856
859
export type GraphQLEnumValueDefinition /* <T> */ = {
857
860
name : string ;
858
861
description : ?string ;
862
+ isDeprecated ?: boolean ;
859
863
deprecationReason : ?string ;
860
864
value : any /* T */ ;
861
865
} ;
0 commit comments