ApolloError: variable 'wallet_addresses' is declared as '[String!]!', but used where '_text' is expected
I get that error above. And my query is below.
mutation updateUser(
$id: Int
$email: String
$wallet_addresses: [String!]!
) {
update_dev_user(
where: {email: {_eq: $email}}
_set: {
wallet_addresses: $wallet_addresses
}
){
returning {
id
email
}
}
}```
I believe the mistake is at the `$wallet_addresses: [String!]!` this part. I have no idea how I an define an array type in the parameter.
[![enter image description here](https://i.sstatic.net/aZcz9.png)](https://i.sstatic.net/aZcz9.png)
I tried
[String!]!
[String!]
[String]
[]
types but got errors in anyway and could find in the docs ( hasura ). I just want to send string array to a table column which has Text[] type.
I solved issue with giving type _text to wallet_addresses parameter and converted string array to array literal.
doc: https://hasura.io/docs/latest/mutations/postgres/insert/#insert-an-object-with-an-array-field
const toArrayLiteral = (arr: string[]) =>
JSON.stringify(arr)?.replace('[', '{')?.replace(']', '}')?.replaceAll('"', '');