Unexpected empty update_many mutation response
namoscato opened this issue · comments
Nick Amoscato commented
Version Information
Server Version: v2.35.1
Environment
OSS and EE
What is the current behaviour?
The update_<table>_many
mutation response returns an object when the updates
argument is an empty array
What is the expected behaviour?
It should always return an array as described by the GraphQL schema for consistency, i.e.
{
"data": {
"update_users_many": [
{
"affected_rows": 0
}
]
}
}
How to reproduce the issue?
-
Invoke an
update_<table>_many
mutation, passing an empty array argument:mutation { update_users_many(updates:[]) { affected_rows } }
-
See that it unexpectedly returns an object:
{ "data": { "update_users_many": { "affected_rows": 0 } } }
Any possible solutions/workarounds you're aware of?
The current state requires awkward conditional logic in GraphQL client implementations
Keywords
multiple updates, mutation, update_many