-
Notifications
You must be signed in to change notification settings - Fork 441
Derive macro for tagged enums (GraphQLUnion) #618
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
Conversation
LegNeato
left a 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.
Looks great! Thank you so much for the PR, we always love new contributors writing high-quality code. 🥂 🎉
A couple of small things:
- Please add a test that actually queries the generated
GraphQLUnion. You can see existing query tests in https://github.com/graphql-rust/juniper/blob/master/juniper/src/tests. - Please add this to the book in the union section so folks know this exists
If you are up to it interfaces are very similar to unions in GraphQL and that would be a great next place to contribute...though they are a bit more complicated than unions.
|
Thanks for the review. Everything you mentioned is fixed. During the testing i encountered some issues. Therefore, skip and documentation annotations are disabled for enumeration fields. Here are some thoughts about these decisions and the implementation. If something is unclear or wrong, let me know.
|
LegNeato
left a 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.
It looks like at least in js unions can have descriptions for the entire thing: https://graphql.org/graphql-js/type/#graphqluniontype and it appears that the union types can as well. But, that is Apollo and not the official spec. So let's leave descriptions and skip out.
Simplifies code and provides the idea of using `util::GraphQLTypeDefinitionField` for different types than objects.
|
This PR should be ready to merge. Applied your feedback and added some minor tweaks. |
|
Awesome, thank you again! |
Implements derive macros for tagged enums which are translated into GraphQLUnion types. The following features are provided
std::convert::From<T>converter for these types.Fixes: #586