graphql-client
graphql-client copied to clipboard
Support `@required` directive
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.