Fork me on GitHub
#graphql
<
2019-09-09
>
lxsli09:09:38

mutation ($DisplayName: String!, $AuthLink: String) {
  onboardCustomer(i: {
    fullName: "Bob"
    displayName: $DisplayName
    authLink: $AuthLink
  }) {
    commandId
  }
}
Is this supposed to work? Seems a reasonable thing to do but it doesn't. Weirdly the error is: "Exception applying arguments to field 'onboardCustomer': For argument 'i', unknown argument 'fullName'."

gklijs10:09:54

Why is the fullName in the json?

lxsli14:09:54

Um, no JSON there? That's GraphQL syntax. I didn't include the query variables JSON as it doesn't make a difference.

lxsli14:09:31

Backend is Lacinia btw.

hlship16:09:06

What is the type of i? Should be an InputObject. Should have a fullName field. Gotta share the details if you expect a response.

4
timgilbert19:09:51

I think you're also missing commas between eg "bob" and displayName:, FWIW.

timgilbert19:09:08

For this type of thing I tend to write the query like mutation ($x: MyInputObject!) { onboardCustomer(i: $x) { commandId } }

timgilbert19:09:53

...and then construct the $x parameter on the Clojure side rather than relying on an object literal in GraphQL syntax

lxsli11:09:35

i is an OnboardCustomerInput which has a fullName field

lxsli11:09:09

The commas are unimportant, you can use them or not

lxsli11:09:30

Supplying the whole input object as a query var does work, but that is not the question

lxsli11:09:51

Sorry I haven't checked in in a while!

lxsli11:09:58

FWIW:

input OnboardCustomerInput {
  fullName: String!
  displayName: String!
  authLink: String
}

lxsli11:09:33

[com.walmartlabs/lacinia "0.29.0-rc-1"]