Struct dynamic_graphql::dynamic::SchemaBuilder
source · pub struct SchemaBuilder { /* private fields */ }
Expand description
Dynamic schema builder
Implementations§
source§impl SchemaBuilder
impl SchemaBuilder
sourcepub fn register(self, ty: impl Into<Type>) -> SchemaBuilder
pub fn register(self, ty: impl Into<Type>) -> SchemaBuilder
Register a GraphQL type
sourcepub fn data<D>(self, data: D) -> SchemaBuilderwhere
D: Any + Send + Sync,
pub fn data<D>(self, data: D) -> SchemaBuilderwhere
D: Any + Send + Sync,
Add a global data that can be accessed in the Schema
. You access it
with Context::data
.
sourcepub fn extension(self, extension: impl ExtensionFactory) -> SchemaBuilder
pub fn extension(self, extension: impl ExtensionFactory) -> SchemaBuilder
Add an extension to the schema.
sourcepub fn limit_complexity(self, complexity: usize) -> SchemaBuilder
pub fn limit_complexity(self, complexity: usize) -> SchemaBuilder
Set the maximum complexity a query can have. By default, there is no limit.
sourcepub fn limit_depth(self, depth: usize) -> SchemaBuilder
pub fn limit_depth(self, depth: usize) -> SchemaBuilder
Set the maximum depth a query can have. By default, there is no limit.
sourcepub fn limit_recursive_depth(self, depth: usize) -> SchemaBuilder
pub fn limit_recursive_depth(self, depth: usize) -> SchemaBuilder
Set the maximum recursive depth a query can have. (default: 32)
If the value is too large, stack overflow may occur, usually 32
is
enough.
sourcepub fn validation_mode(self, validation_mode: ValidationMode) -> SchemaBuilder
pub fn validation_mode(self, validation_mode: ValidationMode) -> SchemaBuilder
Set the validation mode, default is ValidationMode::Strict
.
sourcepub fn disable_suggestions(self) -> SchemaBuilder
pub fn disable_suggestions(self) -> SchemaBuilder
Disable field suggestions.
sourcepub fn disable_introspection(self) -> SchemaBuilder
pub fn disable_introspection(self) -> SchemaBuilder
Disable introspection queries.
sourcepub fn introspection_only(self) -> SchemaBuilder
pub fn introspection_only(self) -> SchemaBuilder
Only process introspection queries, everything else is processed as an error.
sourcepub fn enable_federation(self) -> SchemaBuilder
pub fn enable_federation(self) -> SchemaBuilder
Enable federation, which is automatically enabled if the Query has least one entity definition.
sourcepub fn entity_resolver<F>(self, resolver_fn: F) -> SchemaBuilderwhere
F: for<'a> Fn(ResolverContext<'a>) -> FieldFuture<'a> + Send + Sync + 'static,
pub fn entity_resolver<F>(self, resolver_fn: F) -> SchemaBuilderwhere
F: for<'a> Fn(ResolverContext<'a>) -> FieldFuture<'a> + Send + Sync + 'static,
Set the entity resolver for federation
sourcepub fn finish(self) -> Result<Schema, SchemaError>
pub fn finish(self) -> Result<Schema, SchemaError>
Consumes this builder and returns a schema.