@@ -834,27 +834,30 @@ function defineFieldMap<TSource, TContext>(
834
834
) ;
835
835
836
836
return mapValue ( fieldMap , ( fieldConfig , fieldName ) => {
837
+ const coordinate = `${ config . name } .${ fieldName } ` ;
838
+
837
839
devAssert (
838
840
isPlainObj ( fieldConfig ) ,
839
- `${ config . name } . ${ fieldName } field config must be an object.` ,
841
+ `${ coordinate } field config must be an object.` ,
840
842
) ;
841
843
devAssert (
842
844
fieldConfig . resolve == null || typeof fieldConfig . resolve === 'function' ,
843
- `${ config . name } . ${ fieldName } field resolver must be a function if ` +
845
+ `${ coordinate } field resolver must be a function if ` +
844
846
`provided, but got: ${ inspect ( fieldConfig . resolve ) } .` ,
845
847
) ;
846
848
847
849
const argsConfig = fieldConfig . args ?? { } ;
848
850
devAssert (
849
851
isPlainObj ( argsConfig ) ,
850
- `${ config . name } . ${ fieldName } args must be an object with argument names as keys.` ,
852
+ `${ coordinate } args must be an object with argument names as keys.` ,
851
853
) ;
852
854
853
855
return {
856
+ coordinate,
854
857
name : fieldName ,
855
858
description : fieldConfig . description ,
856
859
type : fieldConfig . type ,
857
- args : defineArguments ( argsConfig ) ,
860
+ args : defineArguments ( coordinate , argsConfig ) ,
858
861
resolve : fieldConfig . resolve ,
859
862
subscribe : fieldConfig . subscribe ,
860
863
deprecationReason : fieldConfig . deprecationReason ,
@@ -865,9 +868,11 @@ function defineFieldMap<TSource, TContext>(
865
868
}
866
869
867
870
export function defineArguments (
871
+ parentCoordinate : string ,
868
872
config : GraphQLFieldConfigArgumentMap ,
869
873
) : ReadonlyArray < GraphQLArgument > {
870
874
return Object . entries ( config ) . map ( ( [ argName , argConfig ] ) => ( {
875
+ coordinate : `${ parentCoordinate } (${ argName } :)` ,
871
876
name : argName ,
872
877
description : argConfig . description ,
873
878
type : argConfig . type ,
@@ -1043,6 +1048,7 @@ export interface GraphQLField<
1043
1048
TContext ,
1044
1049
TArgs = { [ argument : string ] : any } ,
1045
1050
> {
1051
+ coordinate : string ;
1046
1052
name : string ;
1047
1053
description : Maybe < string > ;
1048
1054
type : GraphQLOutputType ;
@@ -1055,6 +1061,7 @@ export interface GraphQLField<
1055
1061
}
1056
1062
1057
1063
export interface GraphQLArgument {
1064
+ coordinate : string ;
1058
1065
name : string ;
1059
1066
description : Maybe < string > ;
1060
1067
type : GraphQLInputType ;
@@ -1503,12 +1510,15 @@ function defineEnumValues(
1503
1510
`${ typeName } values must be an object with value names as keys.` ,
1504
1511
) ;
1505
1512
return Object . entries ( valueMap ) . map ( ( [ valueName , valueConfig ] ) => {
1513
+ const coordinate = `${ typeName } .${ valueName } ` ;
1514
+
1506
1515
devAssert (
1507
1516
isPlainObj ( valueConfig ) ,
1508
- `${ typeName } . ${ valueName } must refer to an object with a "value" key ` +
1517
+ `${ coordinate } must refer to an object with a "value" key ` +
1509
1518
`representing an internal value but got: ${ inspect ( valueConfig ) } .` ,
1510
1519
) ;
1511
1520
return {
1521
+ coordinate,
1512
1522
name : valueName ,
1513
1523
description : valueConfig . description ,
1514
1524
value : valueConfig . value !== undefined ? valueConfig . value : valueName ,
@@ -1558,6 +1568,7 @@ export interface GraphQLEnumValueConfig {
1558
1568
}
1559
1569
1560
1570
export interface GraphQLEnumValue {
1571
+ coordinate : string ;
1561
1572
name : string ;
1562
1573
description : Maybe < string > ;
1563
1574
value : any /* T */ ;
@@ -1667,12 +1678,15 @@ function defineInputFieldMap(
1667
1678
`${ config . name } fields must be an object with field names as keys or a function which returns such an object.` ,
1668
1679
) ;
1669
1680
return mapValue ( fieldMap , ( fieldConfig , fieldName ) => {
1681
+ const coordinate = `${ config . name } .${ fieldName } ` ;
1682
+
1670
1683
devAssert (
1671
1684
! ( 'resolve' in fieldConfig ) ,
1672
- `${ config . name } . ${ fieldName } field has a resolve property, but Input Types cannot define resolvers.` ,
1685
+ `${ coordinate } field has a resolve property, but Input Types cannot define resolvers.` ,
1673
1686
) ;
1674
1687
1675
1688
return {
1689
+ coordinate,
1676
1690
name : fieldName ,
1677
1691
description : fieldConfig . description ,
1678
1692
type : fieldConfig . type ,
@@ -1725,6 +1739,7 @@ export interface GraphQLInputFieldConfig {
1725
1739
export type GraphQLInputFieldConfigMap = ObjMap < GraphQLInputFieldConfig > ;
1726
1740
1727
1741
export interface GraphQLInputField {
1742
+ coordinate : string ;
1728
1743
name : string ;
1729
1744
description : Maybe < string > ;
1730
1745
type : GraphQLInputType ;
0 commit comments