async-graphql icon indicating copy to clipboard operation
async-graphql copied to clipboard

How to use recursive generic InputObject

Open onichandame opened this issue 3 years ago • 0 comments

Currently the following code does not compile:

#[derive(InputObject)]
#[graphql(concrete(name = "StringNode", params(String)))]
pub struct Node<T: InputType> {
    value: T,
    children: Vec<Node<T>>,
}

The error I am seeing is:

the trait bound `Node<T>: InputType` is not satisfied
required because of the requirements on the impl of `InputType` for `Vec<Node<T>>`

onichandame avatar Mar 06 '22 09:03 onichandame