-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 #3772
Conversation
The graphql-java team @andimarek and @dondonz discussed this today. We decided that we would accept this feature with the idea that is very much opt in. So rather than use src/main/java/graphql/schema/idl/SchemaGenerator.java and its Options to "auto put" the directive in place we would require that people copy the directive into their schema themselves. if some one was programmatically creating a schema say then they would have to add This is in line with how the experimental @defer is also required to be added to the SDL in text form or programmatically added to the schema say Also we should adopt the same "opt in" mechanism as defer uses eg We should create another String constant like this and if its present in the graphql context, then this code is enabled eg something like this
We have to think of a name of this "feature" and I dont think "error handling" is a great name because its so general versus this very specific "dont bubble non null errors up" form of error handling. So this also calls into question the directive name of "errorHandling" - again its a general term but in practice this is actually a very specific thing (non null exception propogration or not ) |
@bbakerman makes a lot of sense, this is very similar to I pushed some changes here. Let me know what you think. Re: naming, it's hard 😅 . I went with |
src/test/groovy/graphql/execution/NoErrorPropagationTest.groovy
Outdated
Show resolved
Hide resolved
Thanks for the update and removing the SchemaGenerator code. I think the final part here is the naming. Right now its
My problem with the name is I think we should name this directive more specifically about this "non null type field returning null" behavior.
Here are my suggestions (with a matching directive argument and enum type)
The last one is my favourite name because we could extend it for further contract failures in the future (but probably not)
Thoughts? |
I read
This makes sense:
If you want to implement the introspection changes at the same time then I think you're probably right to hold off implementing it until the latter solution has the spec changes fully written out 👍 If you're happy only implementing the non-introspection features, then both proposals work in the same way (error propagation is disabled - errors (including nulls in non-null positions) never bubble) and there's no need to wait. |
For the record, I believe we shouldn't always wait for an RFC to be complete before adding (experimental) features. The WG discussion have been going on for a while now and getting something relatively simple out so that people can toy around with has lots of value IMO. That being said, alignment is also good. Let's discuss! In the meantime, I'll revert to |
This reverts commit e744cca.
@michaelstaib can you elaborate on your plans here? thanks! |
Matching pull request there for graphql-js: graphql/graphql-js#4348 |
~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: ```graphql """ Disables error propagation. """ directive @experimental_disableErrorPropagation on QUERY | MUTATION | SUBSCRIPTION ``` 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](graphql-java/graphql-java#3772) 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 --------- Co-authored-by: Jovi De Croock <decroockjovi@gmail.com>
I've synced this PR with graphql/graphql-js#4348 and There was a consensus to make the directive experimental by prefixing it with The name I have also removed the |
.gitignore
Outdated
@@ -1,7 +1,8 @@ | |||
*.iml | |||
*.ipr | |||
*.iws | |||
.idea | |||
.idea/* | |||
!.idea/codeStyles |
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.
Sorry can we get rid of these.
I dont want "outside opnions" on how we set up our IDEA in tis PR.
Make another PR if this is something we should do
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.
Sure thing! 535a620
Rather than ask for these changes - I decided to push to your branch as a maintainer and then get them into your PR
We want to make another change so that BUT this does not have to be this PR (it will break one test here - which is good - TDD) |
Thanks for the review!
Are you talking about FWIW, in graphql-js, the user has to add the directive definition manually for it to be recognized. This how the "opt-in" is done. Of course, it's perfectly fine for different projects to have different conventions, just surfacing that here so we're aligned! In all cases, let me know if this PR needs anything else. |
Rather than ask for these changes - I decided to push to your branch as a maintainer and then get them into your PR This now adds the directive to the schema if not present
Rather than ask for these changes - I decided to push to your branch as a maintainer and then get them into your PR * import
Rather than ask for these changes - I decided to push to your branch as a maintainer and then get them into your PR Added the directive to common list
Thanks for contributing this PR and for your work championing the spec @martinbonnin |
Thanks all for the reviews! Looking forward to trying it out! |
This pull request adds support for
@experimental_disableErrorPropagation
to disable error propagation for error aware clients:Fixes #3756
See graphql/nullability-wg#85
See graphql/graphql-spec#1050
See graphql/graphql-js#4348