pub struct CompiledSchemaLoader { /* private fields */ }Expand description
Loader for compiled GraphQL schemas from JSON files.
Loads and caches a compiled schema from a JSON file on disk. Used during server startup to prepare the schema for query execution.
Implementations§
Source§impl CompiledSchemaLoader
impl CompiledSchemaLoader
Sourcepub async fn load(&self) -> Result<CompiledSchema, SchemaLoadError>
pub async fn load(&self) -> Result<CompiledSchema, SchemaLoadError>
Load schema from file.
Reads the schema JSON file, parses it, and returns a CompiledSchema.
§Errors
Returns SchemaLoadError::NotFound if the file does not exist.
Returns SchemaLoadError::IoError if the file cannot be read.
Returns SchemaLoadError::ParseError if the JSON is malformed.
Returns SchemaLoadError::ValidationError if schema validation fails.
§Example
// Requires: schema.compiled.json file on disk.
let loader = CompiledSchemaLoader::new("schema.compiled.json");
let schema = loader.load().await?;Sourcepub async fn load_extended(
&self,
) -> Result<ExtendedCompiledSchema, SchemaLoadError>
pub async fn load_extended( &self, ) -> Result<ExtendedCompiledSchema, SchemaLoadError>
Load schema and all optional platform extension sections from file.
In addition to the core schema (types, queries, mutations, subscriptions),
this method parses and validates the "storage", "functions", and
"realtime" top-level keys if they are present. Unknown top-level keys are
ignored for forward compatibility.
§Errors
Returns SchemaLoadError::NotFound if the file does not exist.
Returns SchemaLoadError::IoError if the file cannot be read.
Returns SchemaLoadError::ParseError if the JSON is malformed.
Returns SchemaLoadError::ValidationError if any of the following fail:
- A storage bucket name contains whitespace or is empty.
- A function trigger string does not match a recognised pattern.
- A realtime entity name does not appear in the schema’s type definitions.
Trait Implementations§
Source§impl Clone for CompiledSchemaLoader
impl Clone for CompiledSchemaLoader
Source§fn clone(&self) -> CompiledSchemaLoader
fn clone(&self) -> CompiledSchemaLoader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompiledSchemaLoader
impl RefUnwindSafe for CompiledSchemaLoader
impl Send for CompiledSchemaLoader
impl Sync for CompiledSchemaLoader
impl Unpin for CompiledSchemaLoader
impl UnsafeUnpin for CompiledSchemaLoader
impl UnwindSafe for CompiledSchemaLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more