Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected empty update_many mutation response #10239

Open
namoscato opened this issue May 15, 2024 · 0 comments
Open

Unexpected empty update_many mutation response #10239

namoscato opened this issue May 15, 2024 · 0 comments
Labels
k/bug Something isn't working

Comments

@namoscato
Copy link
Contributor

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?

  1. Invoke an update_<table>_many mutation, passing an empty array argument:

    mutation {
      update_users_many(updates:[]) {
        affected_rows
      }
    }
  2. 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

@namoscato namoscato added the k/bug Something isn't working label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant