Skip to content

Instantly share code, notes, and snippets.

@iancormac84
Last active August 13, 2019 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iancormac84/115c5ba97b7cb13bab02f0f0fb17d545 to your computer and use it in GitHub Desktop.
Save iancormac84/115c5ba97b7cb13bab02f0f0fb17d545 to your computer and use it in GitHub Desktop.
Gist displaying GraphQL, JSON, and Rust code snippets for help question.
{
"errors":[
{
"message":"Variable \"$input\" expected value of type \"Owner\" which cannot be used as an input type.",
"locations":[
{
"line":1,
"column":19
}
]
}
]
}
let input = Owner::new(
"John".to_string(),
"Doe".to_string(),
Some("Strange".to_string()),
Gender::Male,
vec!["+14687210744573"],
vec!["example@gmail.com"]
).unwrap();
let query =
r#"mutation AddOwner($input: Owner) {
addOwner(input: $input) {
id
}
}"#;
let value = json!({
"query": query,
"variables": {
"input": input
}
});
{
"query":"mutation AddOwner($input: Owner) {\n addOwner(input: $input) {\n id\n }\n }",
"variables":{
"input":{
"_id":{
"$oid":"5d53488f005b23ea00c14f59"
},
"first_name":"John",
"surname":"Doe",
"other_names":"Strange",
"gender":"Male",
"contact_numbers":[
"+14687210744573"
],
"email_addresses":[
"example@gmail.com"
]
}
}
}
enum Gender {
Male
Female
}
type Owner {
id: ObjectId!
firstName: String!
surname: String!
otherNames: String
gender: Gender!
contactNumbers: [String]!
emailAddresses: [String]!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment