Module async_graphql::dynamic

source ·
Available on crate feature dynamic-schema only.
Expand description

Suppport for dynamic schema

Create a simple GraphQL schema

use async_graphql::{dynamic::*, value, Value};

let query = Object::new("Query").field(Field::new("value", TypeRef::named_nn(TypeRef::INT), |ctx| {
    FieldFuture::new(async move { Ok(Some(Value::from(100))) })
}));


let schema = Schema::build(query.type_name(), None, None)
    .register(query)
    .finish()?;

assert_eq!(
   schema
       .execute("{ value }")
       .await
       .into_result()
       .unwrap()
       .data,
   value!({ "value": 100 })
);

Re-exports

Structs

Enums

Traits