From 2f79f33a82427570d25c954a1be31f69fb14be60 Mon Sep 17 00:00:00 2001 From: Magnus Hallin <mhallin@fastmail.com> Date: Sun, 19 Feb 2017 12:51:12 +0100 Subject: [PATCH] Document input object default values --- src/macros/input_object.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/macros/input_object.rs b/src/macros/input_object.rs index c596e482..dbc43bc8 100644 --- a/src/macros/input_object.rs +++ b/src/macros/input_object.rs @@ -9,7 +9,7 @@ is what will be generated: ```rust # #[macro_use] extern crate juniper; - +# graphql_input_object!( description: "Coordinates for the user" @@ -29,6 +29,21 @@ and arguments. If you want to expose the struct under a different name than the Rust type, you can write `struct Coordinates as "MyCoordinates" { ...`. +You can specify *default values* for input object fields; the syntax +is similar to argument default values: + +```rust +# #[macro_use] extern crate juniper; +# +graphql_input_object!( + struct SampleObject { + foo = 123: i64 as "A sample field, defaults to 123 if omitted" + } +); + +# fn main() { } +``` + */ #[macro_export] macro_rules! graphql_input_object {