Skip to content
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

Support @required directive #473

Open
bradzacher opened this issue Jan 11, 2024 · 0 comments
Open

Support @required directive #473

bradzacher opened this issue Jan 11, 2024 · 0 comments

Comments

@bradzacher
Copy link

https://relay.dev/docs/guides/required-directive/

It's not part of the spec but it makes working with GraphQL queries as a client much easier.
A lot of the code I write looks like foo.unwrap().bar.baz.unwrap().bam.unwrap() - it's a pain to work with the query response because we have to handle the nullability manually.

@required is a client directive that essentially says "if this field is null, throw an error". This is essentially the same as writing .unwrap() everywhere - except that the macro can handle it for us.

This would greatly simplify the development process for cases where we know something can never be null, even if the query types don't show it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant