Rust crate for pruning fields from type schemas
use common::{Location, Span};
use crate::{ExecutableDefinition, TypeSystemDefinition};
+use std::fmt;
/// A GraphQL document containing any type of definition. This can represent
/// any GraphQL document.
@@ -39,3 +40,15 @@ pub struct SchemaDocument {
pub location: Location,
pub definitions: Vec<TypeSystemDefinition>,
}
+
+impl fmt::Display for SchemaDocument {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let v = self
+ .definitions
+ .iter()
+ .map(|definition| definition.to_string())
+ .collect::<Vec<String>>()
+ .join("\n");
+ writeln!(f, "{}", v)
+ }
+}
