Multiple queries/mutations in single request tricky due to errors decoupling #452
chladog
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 4 replies
-
Wow @chladog, thank you for the level of detail here and in #451. I can't see us commiting to the union error objects as you described, though that is very interesting. It would be a big pivot from our current GraphQL API. I'll work up a fix for the bug and we can also add the path and nodes of the error too. After that I can look at #451 and see how we can help you along there. How does that sound to you? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This query will result in response that has couple of problems:
1.) we can see one of the subtask was successful, but there are 2 error which we are unable to connect with each subtask
2.) BUG: the error of the 2nd (and any other) invalid subtask is overwritten by the error of the 1st invalid subtask - as the error of 2nd invalid subtask should actually be
"No password was given"
as [email protected] is actually NOT existing, running the subtask separately in own request will return correct message.From my experience a great solution to the first problem is to move error handling to the query objects as union types. Though it's a change of schema and would need some refactoring of existing projects, but maybe would be worth it as it brings so much flexibility.
The queries and mutations would change to the following sample:
Other solution might be to introduce somekind of "path" to the error object to be able to pair it with the subtask.
The queries here are just to showcase the problems as it's probably not very useful to create multiple users at same time. But there are many useful cases of merging requests, for example bulk updates from list-views.
Beta Was this translation helpful? Give feedback.
All reactions