pub struct SchemaDefinition { /* private fields */ }
Expand description
A GraphQL service’s collective type system capabilities are referred to as that service’s “schema”.
SchemaDefinition: Description? schema Directives? { RootOperationTypeDefinition* }
Detailed documentation can be found in GraphQL spec.
§Example
use apollo_encoder::{SchemaDefinition};
use indoc::indoc;
let mut schema_def = SchemaDefinition::new();
schema_def.query("TryingToFindCatQuery".to_string());
schema_def.mutation("MyMutation".to_string());
schema_def.subscription("MySubscription".to_string());
assert_eq!(
schema_def.to_string(),
indoc! { r#"
schema {
query: TryingToFindCatQuery
mutation: MyMutation
subscription: MySubscription
}
"#}
);
Implementations§
Source§impl SchemaDefinition
impl SchemaDefinition
Sourcepub fn description(&mut self, description: String)
pub fn description(&mut self, description: String)
Set the SchemaDef’s description.
Sourcepub fn subscription(&mut self, subscription: String)
pub fn subscription(&mut self, subscription: String)
Set the schema def’s subscription type.
Trait Implementations§
Source§impl Clone for SchemaDefinition
impl Clone for SchemaDefinition
Source§fn clone(&self) -> SchemaDefinition
fn clone(&self) -> SchemaDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SchemaDefinition
impl Debug for SchemaDefinition
Source§impl Default for SchemaDefinition
impl Default for SchemaDefinition
Source§impl Display for SchemaDefinition
impl Display for SchemaDefinition
Source§impl TryFrom<SchemaDefinition> for SchemaDefinition
impl TryFrom<SchemaDefinition> for SchemaDefinition
Source§fn try_from(node: SchemaDefinition) -> Result<Self, Self::Error>
fn try_from(node: SchemaDefinition) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
§Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.
Source§impl TryFrom<SchemaExtension> for SchemaDefinition
impl TryFrom<SchemaExtension> for SchemaDefinition
Source§fn try_from(node: SchemaExtension) -> Result<Self, Self::Error>
fn try_from(node: SchemaExtension) -> Result<Self, Self::Error>
Create an apollo-encoder node from an apollo-parser one.
§Errors
This returns an error if the apollo-parser tree is not valid. The error doesn’t have much context due to TryFrom API constraints: validate the parse tree before using TryFrom if granular errors are important to you.