In role-based schemas, if graphql query fails, return null or errors in addition to the payload
See original GitHub issueLet’s say a graphql request is made:
query {
profile { id name age }
}
and age
is not in the schema (or the role-based schema).
It is desirable in most situations to still receive the response for id & name along with an additional errors object adjacent to the data that is sent in the response. This is a behaviour desired only if these columns are used in the selection-set and not in the arguments. Currently the response is that graphql query validation failed entirely.
(via ben/cherre and matt/dsi)
@0x777 @dsandip this needs quick triaging. @0x777 comments?
Incidentally, @shahidhk, this is the behaviour with the github graphql api too right?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ. OPERATION_RESOLUTION_FAILURE. The...
Read more >GraphQL mutation errors (union errors with interface aka 6a ...
This article tries to show the concrete implementation of stage 6a mutation error handling from Marc-Andre Giroux Guide to graphql errors ...
Read more >A Guide to GraphQL Errors
One annoying part of just adding error fields to the mutation payload is that we allow for some impossible states in theory. In...
Read more >Why does a GraphQL query return null? - Stack Overflow
If a Promise rejects, that field will return null and the appropriate error will be added to the errors array in the response....
Read more >Sub fields returning null · Issue #31 · miragejs/graphql - GitHub
Having an issue returning sub fields.. Not sure If there is something I need to add to resolvers, but have attempted that as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This can only be done if we abandon our current role based schemas (which I think is a bad idea) so I’m closing this.
I guess what the GitHub API does is that permissions are checked on the execution phase rather than in the validation phase like us.