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§
- Directive
- A GraphQL directive
- Dynamic
Request - GraphQL request for dynamic schema.
- Enum
- A GraphQL enum type
- Enum
Item - A GraphQL enum item
- Field
- A GraphQL field
- Field
Value - A value returned from the resolver function
- Input
Object - A GraphQL input object type
- Input
Value - A GraphQL input value type
- Interface
- A GraphQL interface type
- Interface
Field - A GraphQL interface field type
- List
Accessor - A list accessor
- Object
- A GraphQL object type
- Object
Accessor - A object accessor
- Resolver
Context - A context for resolver function
- Scalar
- A GraphQL scalar type
- Schema
- Dynamic GraphQL schema.
- Schema
Builder - Dynamic schema builder
- Schema
Error - An error can occur when building dynamic schema
- Subscription
- A GraphQL subscription type
- Subscription
Field - A GraphQL subscription field
- Subscription
Field Future - A future that returned from field resolver
- Union
- A GraphQL union type
- Value
Accessor - A value accessor
Enums§
- Field
Future - A future that returned from field resolver
- Type
- A GraphQL type
- TypeRef
- A type reference
Traits§
- Dynamic
Request Ext - A trait for
DynamicRequest