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 24, 2019
1 parent 3fa27bb commit 8aff177
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ export default (function PgConnectionArgCondition(builder) {
} = build;
const {
scope: {
fieldName,
isPgFieldConnection,
isPgFieldSimpleCollection,
pgFieldIntrospection,
pgFieldIntrospectionTable,
},
addArgDataGenerator,
Self,
field,
} = context;

const shouldAddCondition =
Expand Down Expand Up @@ -186,7 +186,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,12 +14,12 @@ export default (function PgConnectionArgs(builder) {
} = build;
const {
scope: {
fieldName,
isPgFieldConnection,
isPgFieldSimpleCollection,
pgFieldIntrospection: source,
},
addArgDataGenerator,
field,
Self,
} = context;

Expand Down Expand Up @@ -120,10 +120,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,14 +69,14 @@ export default (function PgConnectionArgOrderBy(builder, { orderByNullsLast }) {
} = build;
const {
scope: {
fieldName,
isPgFieldConnection,
isPgFieldSimpleCollection,
pgFieldIntrospection,
pgFieldIntrospectionTable,
},
addArgDataGenerator,
Self,
field,
} = context;

if (!isPgFieldConnection && !isPgFieldSimpleCollection) {
Expand Down Expand Up @@ -178,7 +178,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,9 +12,8 @@ export default (function PgConnectionArgOrderByDefaultValue(builder) {
inflection,
} = build;
const {
scope: { isPgFieldConnection, pgFieldIntrospection: table },
scope: { fieldName, isPgFieldConnection, pgFieldIntrospection: table },
Self,
field,
} = context;

if (
Expand Down Expand Up @@ -46,7 +45,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,9 +63,8 @@ export default (function ClientMutationIdDescriptionPlugin(
(args: {}, build, context) => {
const { extend } = build;
const {
scope: { isRootMutation },
scope: { isRootMutation, fieldName },
Self,
field,
} = context;
if (!isRootMutation || !args.input || args.input.description) {
return args;
Expand All @@ -78,9 +77,9 @@ export default (function ClientMutationIdDescriptionPlugin(
description:
"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
}' field in '${Self.name}'`
`Adding a description to input arg for field '${fieldName}' field in '${
Self.name
}'`
),
};
},
Expand Down

0 comments on commit 8aff177

Please sign in to comment.