-
Notifications
You must be signed in to change notification settings - Fork 441
Closed
Labels
enhancementImprovement of existing features or bugfixImprovement of existing features or bugfix
Description
Describe the solution you'd like
It would be cool to be able to define GraphQL unions like so:
#[derive(GraphQLObject)]
struct Square {
/// length of one side
pub length: i32,
}
#[derive(GraphQLObject)]
struct Circle {
/// radius of the circle
pub radius: i32,
}
#[juniper::graphql_union]
enum Shape {
Square(Square),
Circle(Circle),
}I understand the current implementation is quite similar already, however it would be cool if we could pull the boilerplate into the macro somehouw..
Describe alternatives you've considered
This would be an alternative (and more ergonomic) alternative to the current implementation. Here is it in use (imagine a query that returns a FieldResult<Shape>):
query {
getShapes {
...on Square { length }
...on Circle { radius }
}
}oeb25
Metadata
Metadata
Assignees
Labels
enhancementImprovement of existing features or bugfixImprovement of existing features or bugfix