Skip to main content

Module schema

Module schema 

Source
Expand description

§Using Schema Definitions

The graphql_query::schema module contains utilities to create a GraphQL Schema or parse it from introspection data. This information may then be used to validate and introspect a schema as to possible queries that may be written against it.

The BuildClientSchema trait may be used to convert introspection data into a usable Schema, which may then be used to inspect GraphQL defnitions:

use graphql_query::{ast::ASTContext, schema::*};

fn inspect() {
    let ctx = ASTContext::new();

    let introspection_json = include_str!("../../fixture/introspection_query.json");
    let introspection: IntrospectionQuery = serde_json::from_str(introspection_json).unwrap();
    let _schema = introspection.build_client_schema(&ctx);
}

More information on the Schema struct.

Re-exports§

pub use build_client_schema::BuildClientSchema;
pub use introspection::IntrospectionQuery;
pub use introspection::IntrospectionSchema;

Modules§

build_client_schema
introspection
sdl

Structs§

Schema
Schema Definition
SchemaEnum
SchemaField
An object Field type definition.
SchemaInputField
SchemaInputObject
An Input Object type definition.
SchemaInterface
An Interface type definition.
SchemaObject
An Object type definition.
SchemaReference
Schema Reference
SchemaScalar
A Scalar type definition.
SchemaUnion
A Union type definition.

Enums§

InputType
An input type enum that represents all possible GraphQL definition types that an argument or input object field may accept.
OutputType
An output type enum that represents all possible GraphQL definition types that a field may return.
OwnedSchemaType
SchemaType
A named type enum that represents all possible GraphQL definition types.
TypeRef

Traits§

Named
Helper trait to generalize comparisons (see eq_named_lists).
SchemaFields
Generic trait for any schema type that implements fields
SchemaInterfaces
Generic trait for any schema type that implements interfaces
SchemaPossibleTypes
Generic trait for any schema type that implements interfaces
SchemaSuperType
Generic trait for any schema type that may be a super type of other types

Functions§

schema_type_to_type