Struct apollo_compiler::ast::Document
source · pub struct Document {
pub sources: SourceMap,
pub definitions: Vec<Definition>,
}
Fields§
§sources: SourceMap
If this document was originally parsed from a source file, this map contains one entry for that file and its ID.
The document may have been modified since.
definitions: Vec<Definition>
Implementations§
source§impl Document
impl Document
sourcepub fn parse(source_text: impl Into<String>, path: impl AsRef<Path>) -> Self
pub fn parse(source_text: impl Into<String>, path: impl AsRef<Path>) -> Self
Parse input
with the default configuration
path
is the filesystem path (or arbitrary string) used in diagnostics
to identify this source file to users.
sourcepub fn check_parse_errors(&self) -> Result<(), Diagnostics>
pub fn check_parse_errors(&self) -> Result<(), Diagnostics>
Returns Diagnostics
for cases where parsed input does not match
the GraphQL grammar or where the parser reached a token limit or recursion limit.
Does not perform any validation beyond this syntactic level.
sourcepub fn validate_standalone_executable(&self) -> Result<(), Diagnostics>
pub fn validate_standalone_executable(&self) -> Result<(), Diagnostics>
Validate as an executable document, as much as possible without a schema
sourcepub fn to_schema_builder(&self, builder: &mut SchemaBuilder)
pub fn to_schema_builder(&self, builder: &mut SchemaBuilder)
Add this AST document as an additional input to a schema builder.
This can be used to build a schema from multiple documents or source files.
sourcepub fn to_executable(&self, schema: &Schema) -> ExecutableDocument
pub fn to_executable(&self, schema: &Schema) -> ExecutableDocument
Build an executable document from this AST, with the given schema
sourcepub fn to_mixed(&self) -> (Schema, ExecutableDocument)
pub fn to_mixed(&self) -> (Schema, ExecutableDocument)
Build a schema and executable document from this AST containing a mixture of type system definitions and executable definitions. This is mostly useful for unit tests.
Trait Implementations§
source§impl PartialEq for Document
impl PartialEq for Document
source
is ignored for comparison
impl Eq for Document
Auto Trait Implementations§
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.