From 9b79c2232b9089f13b8d3b7a75aa771e35d49fe9 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Fri, 23 Sep 2022 11:52:05 -0600 Subject: [PATCH] docs: Fix more attributes in examples --- docs/en/src/apollo_federation.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/en/src/apollo_federation.md b/docs/en/src/apollo_federation.md index be8eece1..b85ac759 100644 --- a/docs/en/src/apollo_federation.md +++ b/docs/en/src/apollo_federation.md @@ -13,7 +13,9 @@ Apollo Federation is a GraphQL architecture for combining multiple GraphQL servi # use async_graphql::*; # struct Query; # #[Object] -# impl Query {} +# impl Query { +# async fn hello(&self) -> String { "Hello".to_string() } +# } fn main() { let schema = Schema::build(Query, EmptyMutation, EmptySubscription) .enable_federation() @@ -283,7 +285,7 @@ struct Query; #[Object] impl Query { /// This operation will provide the `humanName` field on `Product - #[graphql(provides(fields: "humanName"))] + #[graphql(provides = "humanName")] async fn out_of_stock_products(&self) -> Vec { vec![Product { id: "1".to_string(), @@ -359,7 +361,7 @@ impl Product { #[graphql(requires = "size weightInPounds")] async fn shipping_estimate(&self) -> String { let price = self.size * self.weight_in_pounds; - format!(${}, price) + format!("${}", price) } } ``` @@ -370,7 +372,6 @@ Note that we use the GraphQL field name `weightInPounds`, not the Rust field nam # extern crate async_graphql; # use async_graphql::*; # #[derive(SimpleObject)] -# #[graphql(complex)] # struct Product { # id: ID, # #[graphql(external)]