Skip to content

Commit

Permalink
fix(procedures): fix arg refs where SQL and GraphQL field names differ (
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Oct 13, 2017
1 parent 663cedc commit ea5a44f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/graphile-build-pg/src/plugins/makeProcField.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ export default function makeProcField(
// defaults in SQL.
while (
sqlArgValues.length > requiredArgCount &&
args[argNames[sqlArgValues.length - 1]] == null
args[
inflection.argument(
argNames[sqlArgValues.length - 1],
sqlArgValues.length - 1
)
] == null
) {
sqlArgValues.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mutation {
jsonIdentityMutationIssue85: jsonIdentityMutation(input: { json: "[{\"amount\":\"44\"},{\"amount\":null}]" }) { json }
jsonbIdentityMutationIssue85: jsonbIdentityMutation(input: { json: "[{\"amount\":\"44\"},{\"amount\":null}]" }) { json }
jsonbIdentityMutationPlpgsqlIssue85: jsonbIdentityMutationPlpgsql(input: { _theJson: "[{\"amount\":\"44\"},{\"amount\":null}]" }) { json }
jsonbIdentityMutationPlpgsqlWithDefaultIssue85: jsonbIdentityMutationPlpgsqlWithDefault(input: {}) { json }
jsonbIdentityMutationPlpgsqlOverridingDefaultIssue85: jsonbIdentityMutationPlpgsqlWithDefault(input: { _theJson: "[{\"amount\":\"44\"},{\"amount\":null}]" }) { json }
add1Mutation(input: { arg0: 1, arg1: 2 }) { clientMutationId integer }
add2Mutation(input: { clientMutationId: "hello", a: 2, b: 2 }) { clientMutationId integer }
add3Mutation(input: { clientMutationId: "world", arg1: 5 }) { clientMutationId integer }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,12 @@ Object {
"jsonbIdentityMutationPlpgsqlIssue85": Object {
"json": "[{\\"amount\\":\\"44\\"},{\\"amount\\":null}]",
},
"jsonbIdentityMutationPlpgsqlOverridingDefaultIssue85": Object {
"json": "[{\\"amount\\":\\"44\\"},{\\"amount\\":null}]",
},
"jsonbIdentityMutationPlpgsqlWithDefaultIssue85": Object {
"json": "[]",
},
"mult1": Object {
"integer": 0,
},
Expand Down

0 comments on commit ea5a44f

Please sign in to comment.