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
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 Interface Definition.