Document input object default values
This commit is contained in:
parent
0b07dbe99a
commit
2f79f33a82
1 changed files with 16 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue