vue.jsgraphqlapollovue-apollographql-mutation

Apollo/Graphql mutate array


I am trying to mutate an array in my Vue application via Apollo to my Graphql backend. For example the array which I try to mutate is stored in my schema as:

type type1 {
    property1: [BigInt]!
}

However, when I assign and pass a string to my mutation, i.e. "[1, 2, 3]" something weird happens and a large integer number will be stored, i.e. "5013710821996412394", instead of my list. When I just try to pass an array I am not able to send my mutation and I get the status error 400 for bad request.

What kind of datatype for the array do I need to execute my mutation correctly to my backend graphql server?


Solution

  • Okay it works now with an array of strings. Before I passed an array of integers to my mutation:

    array = [1, 2, 3]
    

    Now I have:

    array = ["1", "2", "3"]
    

    ... and I am able to execute my mutation correctly. :)