A OneofObject is a special type of InputObject, in which only one of its fields must be set and is not-null. It is especially useful when you want a user to be able to choose between several potential input types.

This feature is still an RFC and therefore not yet officially part of the GraphQL spec, but Async-graphql already supports it!

fn main() {
extern crate async_graphql;
struct User { a: i32 }
use async_graphql::*;

enum UserBy {

struct Address {
    street: String,
    house_number: String,
    city: String,
    zip: String,

struct Query {}

impl Query {
    async fn search_users(&self, by: Vec<UserBy>) -> Vec<User> {
        // ... Searches and returns a list of users ...

As you can see, a OneofObject is represented by an enum in which each variant contains another InputType. This means that you can use InputObject as variant too.