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§
pub use indexmap;
Structs§
- GraphQL request for dynamic schema.
- A GraphQL enum type
- A GraphQL enum item
- A GraphQL field
- A value returned from the resolver function
- A GraphQL input object type
- A GraphQL input value type
- A GraphQL interface type
- A GraphQL interface field type
- A list accessor
- A GraphQL object type
- A object accessor
- A context for resolver function
- A GraphQL scalar type
- Dynamic GraphQL schema.
- Dynamic schema builder
- An error can occur when building dynamic schema
- A GraphQL subscription type
- A GraphQL subscription field
- A future that returned from field resolver
- A GraphQL union type
- A value accessor
Enums§
- A future that returned from field resolver
- A GraphQL type
- A type reference
Traits§
- A trait for
DynamicRequest