Skip to content

Commit

Permalink
Get fieldName from scope, instead of field.name
Browse files Browse the repository at this point in the history
  • Loading branch information
singingwolfboy committed Jul 21, 2019
1 parent 3fa27bb commit 2b640fd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default (function PgConnectionArgCondition(builder) {
} = build;
const {
scope: {
fieldName,
isPgFieldConnection,
isPgFieldSimpleCollection,
pgFieldIntrospection,
Expand Down Expand Up @@ -186,7 +187,7 @@ export default (function PgConnectionArgCondition(builder) {
type: TableConditionType,
},
},
`Adding condition to connection field '${field.name}' of '${Self.name}'`
`Adding condition to connection field '${fieldName}' of '${Self.name}'`
);
},
["PgConnectionArgCondition"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default (function PgConnectionArgs(builder) {
} = build;
const {
scope: {
fieldName,
isPgFieldConnection,
isPgFieldSimpleCollection,
pgFieldIntrospection: source,
Expand Down Expand Up @@ -120,10 +121,10 @@ export default (function PgConnectionArgs(builder) {
: null),
},
isPgFieldConnection
? `Adding connection pagination args to field '${field.name}' of '${
? `Adding connection pagination args to field '${fieldName}' of '${
Self.name
}'`
: `Adding simple collection args to field '${field.name}' of '${
: `Adding simple collection args to field '${fieldName}' of '${
Self.name
}'`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default (function PgConnectionArgOrderBy(builder, { orderByNullsLast }) {
} = build;
const {
scope: {
fieldName,
isPgFieldConnection,
isPgFieldSimpleCollection,
pgFieldIntrospection,
Expand Down Expand Up @@ -178,7 +179,7 @@ export default (function PgConnectionArgOrderBy(builder, { orderByNullsLast }) {
type: new GraphQLList(new GraphQLNonNull(TableOrderByType)),
},
},
`Adding 'orderBy' argument to field '${field.name}' of '${Self.name}'`
`Adding 'orderBy' argument to field '${fieldName}' of '${Self.name}'`
);
},
["PgConnectionArgOrderBy"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default (function PgConnectionArgOrderByDefaultValue(builder) {
inflection,
} = build;
const {
scope: { isPgFieldConnection, pgFieldIntrospection: table },
scope: { fieldName, isPgFieldConnection, pgFieldIntrospection: table },
Self,
field,
} = context;
Expand Down Expand Up @@ -46,7 +46,7 @@ export default (function PgConnectionArgOrderByDefaultValue(builder) {
{
defaultValue: defaultValueEnum && [defaultValueEnum.value],
},
`Adding defaultValue to orderBy for field '${field.name}' of '${
`Adding defaultValue to orderBy for field '${fieldName}' of '${
Self.name
}'`
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default (function ClientMutationIdDescriptionPlugin(
) {
builder.hook(
"GraphQLInputObjectType:fields:field",
(field: { name?: string }, build, context) => {
(field, build, context) => {
const { extend } = build;
const {
scope: { isMutationInput, fieldName },
Expand All @@ -25,15 +25,15 @@ export default (function ClientMutationIdDescriptionPlugin(
description:
"An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client.",
},
`Tweaking '${field.name || ""}' field in '${Self.name}'`
`Tweaking '${fieldName}' field in '${Self.name}'`
);
},
["ClientMutationIdDescription"]
);

builder.hook(
"GraphQLObjectType:fields:field",
(field: { name?: string }, build, context) => {
(field, build, context) => {
const { extend } = build;
const {
scope: { isMutationPayload, fieldName },
Expand All @@ -52,7 +52,7 @@ export default (function ClientMutationIdDescriptionPlugin(
description:
"The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations.",
},
`Tweaking '${field.name || ""}' field in '${Self.name}'`
`Tweaking '${fieldName}' field in '${Self.name}'`
);
},
["ClientMutationIdDescription"]
Expand All @@ -63,7 +63,7 @@ export default (function ClientMutationIdDescriptionPlugin(
(args: {}, build, context) => {
const { extend } = build;
const {
scope: { isRootMutation },
scope: { isRootMutation, fieldName },
Self,
field,
} = context;
Expand All @@ -79,7 +79,7 @@ export default (function ClientMutationIdDescriptionPlugin(
"The exclusive input argument for this mutation. An object type, make sure to see documentation for this object’s fields.",
},
`Adding a description to input arg for field '${
field.name
fieldName
}' field in '${Self.name}'`
),
};
Expand Down

0 comments on commit 2b640fd

Please sign in to comment.