Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.