-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add support for @experimental_disableErrorPropagation #4348
Conversation
Hi @martinbonnin, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've not really debated what this should be yet, I'd propose going with an argument-less and obviously experimental directive such as |
@benjie I renamed to |
I've written up a counter proposal because I think that error propagation should be disabled on a per-client basis rather than a per-operation basis; but I have no issues with this being merged so that people can start experimenting with disabling null propagation - that's the entire point of having experimental directives people can use! Counter-proposal is to make this a request parameter rather than an operation directive: graphql/nullability-wg#86 |
@benjie agree a request parameter would be better. Modifying the document is always taking the risk that what the user types in GraphiQL doesn't match what the client is ultimately sending over the wire. I think we have the same issue with fragment arguments. One nice thing with the directive though is that feature discovery works out of the box. Whereas if we use a request parameter, we'd have to introduce a change in the response or something like this to indicate support. Which feels like a bigger lift. All in all, it's probably not the end of the road but I would still like this to be merged so that we can experiment in parallel of discussing other alternatives. |
One nice thing about the request approach is you don't need feature discovery - you simply turn it on if you're an "error handling client". If the server doesn't support it your request should still succeed and you'll just have some selection sets be blown up as it would have been anyway, so you're no worse off than you were. |
Alright, if we agree that we don't need anything in the response, it might be worth going this road directly. My only objection then is that it potentially requires pull requests in all the servers out there, right (apollo, yoga, etc... )? Because those are the ones calling Whereas the directive solution is "just" a matter of "update your If that's the case, then I'd stick with the long, explicitely experimental directive for now. We can always ask everyone to update all their libs later, once we have a better view of the end game. |
I'm not arguing against using the directive for now, I think we should do that. But long term, I think the request parameter is better. |
Sounds good 👍 . I'll wait for @JoviDeCroock's input and if we all agree, I'll update the graphql-java PR to match |
The request parameter would take the shape of a I am personally a bigger fan of letting language features be described by the With removing the arguments from the directive we are setting ourselves up for poor scalability of the directive, are we open to doing this? I guess we can always add optional arguments but just wanted to surface this. If all of these concerns are good then let's move forward |
I think @benjie had a top-level key in mind?
No strong opinion here besides the fact that we don't have directives on document (yet)?
I'm fine with this. As the long experimental name implies, it's clearly not the final form of this so we can always change later. Also, we could decide to go with |
No; the GraphQL Foundation should never put anything in extensions; the point of extensions is to be a reserved namespace for third parties to put what they want in it - if we start putting stuff there, it no longer serves that purpose. It would be a top-level key like
You should probably give that feedback against my proposal directly; however do think about what this means for users - users who shouldn't need to know how their client works will now need to remember to include this directive in every document (or have tooling add it for them), and in 10 years time, the vast majority of GraphQL documents should have this directive, making it effectively a
We could add arguments in future with a non-breaking change so long as either they're nullable or they have defaults? But also, it's explicitly |
I'm going to digest my thoughts more before I do but generally I am really opposed to little option flags on a top-level payload |
Co-authored-by: Jovi De Croock <[email protected]>
This pull request adds support for@onError(action: NULL)
to disable error propagation for error aware clients:This pull request adds support for
@experimental_disableErrorPropagation
to disable error propagation for error aware clients:I'm not super used to write TypeScript, feel free to amend the PR as needed but I figured it'd be good to have.
The logic is unconditional. The matching graphql-java PR has a specific opt-in flag so that it's not enabled by accident in the very unlikely event that a schema already contains a matching directive. Let me know if this is an issue.
Many thanks @JoviDeCroock for pointing me in the right direction 🙏
See graphql/nullability-wg#85
See graphql/graphql-spec#1050