Sean Proctor
02/17/2024, 3:09 PMSean Proctor
02/17/2024, 3:12 PMmutation updateUser($id: uuid!, $user: user_set_input!, $addRoles: [user_role_insert_input!]!, $updateRoles: [user_role_updates!]!) {
update_user_by_pk(
_set: $user,
pk_columns: {id: $id}
) {
id
}
insert_user_role(objects: $addRoles) {
affected_rows
}
update_user_role_many(updates: $updateRoles) {
affected_rows
}
}
relevant schema:
type mutation_root {
...
update_user_role_many("updates to execute, in order" updates: [user_role_updates!]!): [user_role_mutation_response]
...
}
"""
response of any mutation on the table "user_role"
"""
type user_role_mutation_response {
"""
number of rows affected by the mutation
"""
affected_rows: Int!
"""
data from the rows affected by the mutation
"""
returning: [user_role!]!
}
response from server:
{
"data": {
"update_user_by_pk": {
"id": "62f59281-28a0-4ac0-8c2d-35a3e3d61bb2"
},
"insert_user_role": {
"affected_rows": 1
},
"update_user_role_many": {
"affected_rows": 0
}
}
}
mbonnin
02/17/2024, 3:15 PMmutation_root.update_user_role_many
is a list
• data.update_user_role_many
is returned as a JsonObjectmbonnin
02/17/2024, 3:16 PMSean Proctor
02/17/2024, 3:16 PMmbonnin
02/17/2024, 3:17 PMIf the value passed as an input to a list type is not a list and not the null value, then the result of input coercion is a list of size one
mbonnin
02/17/2024, 3:17 PMIn particular, if a non-list is returned, the coercion should fail, as this indicates a mismatch in expectations between the type system and the implementation.
mbonnin
02/17/2024, 3:20 PMSean Proctor
02/17/2024, 3:20 PMupdate_*_many
. I'll file a bug with them. Thanks for your help!mbonnin
02/17/2024, 3:21 PMSean Proctor
02/17/2024, 4:01 PMSean Proctor
02/17/2024, 4:01 PM