@@ -834,27 +834,30 @@ function defineFieldMap<TSource, TContext>(
834834 ) ;
835835
836836 return mapValue ( fieldMap , ( fieldConfig , fieldName ) => {
837+ const coordinate = `${ config . name } .${ fieldName } ` ;
838+
837839 devAssert (
838840 isPlainObj ( fieldConfig ) ,
839- `${ config . name } . ${ fieldName } field config must be an object.` ,
841+ `${ coordinate } field config must be an object.` ,
840842 ) ;
841843 devAssert (
842844 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 ` +
844846 `provided, but got: ${ inspect ( fieldConfig . resolve ) } .` ,
845847 ) ;
846848
847849 const argsConfig = fieldConfig . args ?? { } ;
848850 devAssert (
849851 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.` ,
851853 ) ;
852854
853855 return {
856+ coordinate,
854857 name : fieldName ,
855858 description : fieldConfig . description ,
856859 type : fieldConfig . type ,
857- args : defineArguments ( argsConfig ) ,
860+ args : defineArguments ( coordinate , argsConfig ) ,
858861 resolve : fieldConfig . resolve ,
859862 subscribe : fieldConfig . subscribe ,
860863 deprecationReason : fieldConfig . deprecationReason ,
@@ -865,9 +868,11 @@ function defineFieldMap<TSource, TContext>(
865868}
866869
867870export function defineArguments (
871+ parentCoordinate : string ,
868872 config : GraphQLFieldConfigArgumentMap ,
869873) : ReadonlyArray < GraphQLArgument > {
870874 return Object . entries ( config ) . map ( ( [ argName , argConfig ] ) => ( {
875+ coordinate : `${ parentCoordinate } (${ argName } :)` ,
871876 name : argName ,
872877 description : argConfig . description ,
873878 type : argConfig . type ,
@@ -1043,6 +1048,7 @@ export interface GraphQLField<
10431048 TContext ,
10441049 TArgs = { [ argument : string ] : any } ,
10451050> {
1051+ coordinate : string ;
10461052 name : string ;
10471053 description : Maybe < string > ;
10481054 type : GraphQLOutputType ;
@@ -1055,6 +1061,7 @@ export interface GraphQLField<
10551061}
10561062
10571063export interface GraphQLArgument {
1064+ coordinate : string ;
10581065 name : string ;
10591066 description : Maybe < string > ;
10601067 type : GraphQLInputType ;
@@ -1503,12 +1510,15 @@ function defineEnumValues(
15031510 `${ typeName } values must be an object with value names as keys.` ,
15041511 ) ;
15051512 return Object . entries ( valueMap ) . map ( ( [ valueName , valueConfig ] ) => {
1513+ const coordinate = `${ typeName } .${ valueName } ` ;
1514+
15061515 devAssert (
15071516 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 ` +
15091518 `representing an internal value but got: ${ inspect ( valueConfig ) } .` ,
15101519 ) ;
15111520 return {
1521+ coordinate,
15121522 name : valueName ,
15131523 description : valueConfig . description ,
15141524 value : valueConfig . value !== undefined ? valueConfig . value : valueName ,
@@ -1558,6 +1568,7 @@ export interface GraphQLEnumValueConfig {
15581568}
15591569
15601570export interface GraphQLEnumValue {
1571+ coordinate : string ;
15611572 name : string ;
15621573 description : Maybe < string > ;
15631574 value : any /* T */ ;
@@ -1667,12 +1678,15 @@ function defineInputFieldMap(
16671678 `${ config . name } fields must be an object with field names as keys or a function which returns such an object.` ,
16681679 ) ;
16691680 return mapValue ( fieldMap , ( fieldConfig , fieldName ) => {
1681+ const coordinate = `${ config . name } .${ fieldName } ` ;
1682+
16701683 devAssert (
16711684 ! ( '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.` ,
16731686 ) ;
16741687
16751688 return {
1689+ coordinate,
16761690 name : fieldName ,
16771691 description : fieldConfig . description ,
16781692 type : fieldConfig . type ,
@@ -1725,6 +1739,7 @@ export interface GraphQLInputFieldConfig {
17251739export type GraphQLInputFieldConfigMap = ObjMap < GraphQLInputFieldConfig > ;
17261740
17271741export interface GraphQLInputField {
1742+ coordinate : string ;
17281743 name : string ;
17291744 description : Maybe < string > ;
17301745 type : GraphQLInputType ;
0 commit comments