You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
S:Send+Sync; // required by `#[async_trait]` transformation ¯\_(ツ)_/¯
306
-
307
306
308
307
// Otherwise, you may mark it explicitly as an executor argument.
309
308
asyncfnname<'b>(
@@ -343,7 +342,7 @@ impl<S: ScalarValue> Character<S> for Human {
343
342
344
343
### Downcasting
345
344
346
-
By default, the [GraphQL interface][1] value is downcast to one of its implementer types via matching the enum variant or downcasting the trait object (if `dyn` is used).
345
+
By default, the [GraphQL interface][1] value is downcast to one of its implementer types via matching the enum variant or downcasting the trait object (if `dyn`macro argument is used).
347
346
348
347
However, if some custom logic is needed to downcast a [GraphQL interface][1] implementer, you may specify either an external function or a trait method to do so.
The attribute syntax `#[graphql_interface(on ImplementerType = resolver_fn)]` follows the [GraphQL syntax for downcasting interface implementer](https://spec.graphql.org/June2018/#example-5cc55).
Copy file name to clipboardExpand all lines: docs/book/content/types/unions.md
+5-3
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
Unions
2
2
======
3
3
4
-
From the server's point of view, [GraphQL unions][1] are similar to interfaces - the only exception is that they don't contain fields on their own.
4
+
From the server's point of view, [GraphQL unions][1] are somewhat similar to [interfaces][5] - the main difference is that they don't contain fields on their own.
5
5
6
-
For implementing [GraphQL unions][1] Juniper provides:
6
+
The most obvious and straightforward way to represent a [GraphQL union][1] in Rust is enum. However, we also can do so either with trait or a regular struct. That's why, for implementing [GraphQL unions][1] Juniper provides:
7
7
-`#[derive(GraphQLUnion)]` macro for enums and structs.
8
8
-`#[graphql_union]` for traits.
9
9
@@ -288,7 +288,7 @@ impl Character for Droid {
288
288
289
289
### Custom context
290
290
291
-
If a context is required in a trait method to resolve a [GraphQL union][1] variant, specify it as an argument.
291
+
If a [`Context`][6] is required in a trait method to resolve a [GraphQL union][1] variant, specify it as an argument.
0 commit comments