Macro juniper::graphql_union
source · macro_rules! graphql_union {
(
@generate,
meta = {
lifetimes = [$($lifetimes:tt,)*],
name = $name:ty,
ctx = $ctx:ty,
main_self = $main_self:ident,
outname = {$($outname:tt)*},
scalar = {$($scalar:tt)*},
$(description = $desciption:tt,)*
additional = {
resolver = {
$(context = $resolver_ctx: ident,)*
items = [
$({
src = $resolver_src: ty,
resolver = $resolver_expr: expr,
},)*
],
},
},
},
items = [],
) => { ... };
(
@parse,
meta = {$($meta:tt)*},
rest = $($rest:tt)*
) => { ... };
(@$($stuff:tt)*) => { ... };
($($rest: tt)*) => { ... };
}
Expand description
Expose GraphQL unions
Like interfaces, mapping unions can be tricky in idiomatic Rust. Because of their similarity, the helper macros are similar, too: you provide a set of expressions that resolve the union into the actual concrete type.
Syntax
See the documentation for graphql_object!
on the general item and type
syntax. graphql_union!
supports only description
and interface_resolvers
items, no fields or interfaces can be declared.
See the documentation for graphql_interface!
on the syntax for interface
resolvers.