Struct apollo_encoder::Schema[][src]

pub struct Schema { /* fields omitted */ }
Expand description

GraphQLSchema represented in Schema Definition Language.

SDL is used as a human-readable format for a given schema to help define and store schema as a string. More information about SDL can be read in this documentation

The Schema struct provides method to encode various types to a schema.

Example

use apollo_encoder::{Schema, Field, UnionDef, EnumValue, Directive, EnumDef, Type_};
use indoc::indoc;

let mut schema = Schema::new();

let mut union_def = UnionDef::new("Cat".to_string());
union_def.description(Some(
    "A union of all cats represented within a household.".to_string(),
));
union_def.member("NORI".to_string());
union_def.member("CHASHU".to_string());
schema.union(union_def);
assert_eq!(
    schema.finish(),
    indoc! { r#"
        "A union of all cats represented within a household."
        union Cat = NORI | CHASHU
    "# }
);

Implementations

Creates a new instance of Schema Encoder.

Adds a new Directive Definition.

Adds a new Type Definition.

Adds a new Schema Definition.

The schema type is only used when the root GraphQL type is different from default GraphQL types.

Adds a new Input Object Definition.

Adds a new Enum Definition.

Adds a new Scalar Definition.

Adds a new Union Definition.

Adds a new Interface Definition.

Return the encoded SDL string after all types have been processed.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.