Successful responses with null data are rejected as errors #28
Labels
No labels
bug
dependencies
duplicate
enhancement
help wanted
invalid
javascript
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gucheen/fetchql#28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
My API includes mutations that don't return any data. They're effectively requests for a low-priority async operation, and they return almost immediately with no information, by just returning
null.That's works fine and its perfectly valid GraphQL as far as I'm aware, but this library rejects these responses, due to
gucheen/fetchql@07d08bef9b/src/index.js (L192-L196)In that code, a successful response that has no errors but which returns a
{ myOperation: null }result will throwundefined.I don't think this case should throw. Even if it does, it should probably throw something clearer than
undefined.According to GraphQL's specification, in 7.1.1 https://spec.graphql.org/June2018/#sec-Data
It's better to return the root type of mutation. I would like to respect the specification.