Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get fieldName from scope, instead of field.name #489

Merged
merged 3 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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