-1

I saw some graphql implementions that returns the whole object after deletion and some implementions that return only the id of the deleted object.

What is the right way according to graphql specification?

kaqqao
  • 12,984
  • 10
  • 64
  • 118
Ron Badur
  • 1,873
  • 2
  • 15
  • 34
  • 1
    Possible duplicate of [Result of a delete mutation?](https://stackoverflow.com/questions/44120314/result-of-a-delete-mutation) – vahdet Feb 12 '19 at 09:09

1 Answers1

1

The specification is not there to dictate API design decisions nor even prescribe best practices. It's there to make sure different GraphQL engines and clients are compatible between each other.

As for you question, there's no right or wrong answer. Do what makes sense for your use-case. If you take an ID as the input for deletion, it makes sense to return the whole object. If you accept the whole object already, there's not much benefit in returning the exact same thing right back...

Decide what makes sense and keep your API consistent across the operations.

kaqqao
  • 12,984
  • 10
  • 64
  • 118