Repository: apollographql/apollo-rs
Pull request #696 (2023-10-12 16:49:42)

Add iteration over each individual diganostic + SourceMap type alias
See changelog

This is a preliminary step towards https://github.com/apollographql/apollo-rs/issues/692


Patch:
diff --git a/crates/apollo-compiler/CHANGELOG.md b/crates/apollo-compiler/CHANGELOG.md
index 1249745..fed2a20 100644
--- a/crates/apollo-compiler/CHANGELOG.md
+++ b/crates/apollo-compiler/CHANGELOG.md
@@ -17,11 +17,44 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
 ## Maintenance
 ## Documentation-->
 
+# [x.x.x] (unreleased) - 2023-mm-dd
+
+## BREAKING
+
+- **Keep source files in `Arc<Map<…>>` everywhere - [SimonSapin], [pull/696]:**
+  Change struct fields from `sources: IndexMap<FileId, Arc<SourceFile>>` (in `Schema`)
+  or `source: Option<(FileId, Arc<SourceFile>)>` (in `Document`, `ExecutablDocument`, `FieldSet`)
+  to `sources: SourceMap`, with:
+  ```rust
+  pub type SourceMap = Arc<IndexMap<FileId, Arc<SourceFile>>>;
+  ```
+  Cases other than `Schema` still only have zero or one source when created by apollo-compiler,
+  but it is now possible to make more sources available to diagnostics,
+  for example when merging documents:
+  ```rust
+  Arc::make_mut(&mut doc1.sources).extend(doc2.sources.iter().map(|(k, v)| (*k, v.clone())));
+  ```
+
+## Features
+
+- **Add iteration over individual diagnostics - [SimonSapin], [pull/696]:**
+  ```rust
+  let schema = Schema::parse(input, "schema.graphql");
+  if let Err(errors) = schema.validate() {
+      for error in errors.iter() {
+          eprintln!("{error}")
+      }
+  }
+  ```
+
+[SimonSapin]: https://github.com/SimonSapin
+[pull/696]: https://github.com/apollographql/apollo-rs/pull/696
+
 # [1.0.0-beta.2](https://crates.io/crates/apollo-compiler/1.0.0-beta.1) - 2023-10-10
 
 ## BREAKING
 
-Assorted `Schema` API changes by [SimonSapin] in [pull/678]:
+**Assorted `Schema` API changes - [SimonSapin], [pull/678]:**
 - Type of the `schema_definition` field changed
   from `Option<SchemaDefinition>` to `SchemaDefinition`.
   Default root operations based on object type names
diff --git a/crates/apollo-compiler/src/ast/from_cst.rs b/crates/apollo-compiler/src/ast/from_cst.rs
index 4e01a61..1d16edc 100644
--- a/crates/apollo-compiler/src/ast/from_cst.rs
+++ b/crates/apollo-compiler/src/ast/from_cst.rs
@@ -17,7 +17,7 @@ impl Document {
         source_file: Arc<SourceFile>,
     ) -> Self {
         Self {
-            source: Some((file_id, source_file)),
+            sources: Arc::new([(file_id, source_file)].into()),
             definitions: document
                 .definitions()
                 .filter_map(|def| def.convert(file_id))
diff --git a/crates/apollo-compiler/src/ast/impls.rs b/crates/apollo-compiler/src/ast/impls.rs
index 778b39c..fad14d5 100644
--- a/crates/apollo-compiler/src/ast/impls.rs
+++ b/crates/apollo-compiler/src/ast/impls.rs
@@ -13,7 +13,7 @@ impl Document {
     /// Create an empty document
     pub fn new() -> Self {
         Self {
-            source: None,
+            sources: Default::default(),
             definitions: Vec::new(),
         }
     }
@@ -36,8 +36,8 @@ impl Document {
     ///
     /// Does not perform any validation beyond this syntactic level.
     pub fn check_parse_errors(&self) -> Result<(), Diagnostics> {
-        let mut errors = Diagnostics::new(self.source.clone().into_iter().collect());
-        if let Some((file_id, source)) = &self.source {
+        let mut errors = Diagnostics::new(None, self.sources.clone());
+        for (file_id, source) in self.sources.iter() {
             source.validate_parse_errors(&mut errors, *file_id)
         }
         errors.into_result()
@@ -51,7 +51,7 @@ impl Document {
             self,
             type_system_definitions_are_errors,
         );
-        let mut errors = Diagnostics::new(self.source.clone().into_iter().collect());
+        let mut errors = Diagnostics::new(None, self.sources.clone());
         crate::executable::validation::validate_standalone_executable(&mut errors, &executable);
         errors.into_result()
     }
@@ -97,9 +97,18 @@ impl Document {
             self,
             type_system_definitions_are_errors,
         );
-        if let Some((_id, file)) = &mut executable.source {
-            // The same parse errors are in `schema.sources`, so they would be redundant here.
-            Arc::make_mut(file).parse_errors = Vec::new()
+        if executable
+            .sources
+            .iter()
+            .any(|(_id, file)| !file.parse_errors.is_empty())
+        {
+            // Remove parse errors from `executable`, redudant as `schema` has the same ones
+            let sources = Arc::make_mut(&mut executable.sources);
+            for (_id, file) in sources.iter_mut() {
+                if !file.parse_errors.is_empty() {
+                    Arc::make_mut(file).parse_errors = Vec::new()
+                }
+            }
         }
         (schema, executable)
     }
diff --git a/crates/apollo-compiler/src/ast/mod.rs b/crates/apollo-compiler/src/ast/mod.rs
index c1e6d86..0b1ca00 100644
--- a/crates/apollo-compiler/src/ast/mod.rs
+++ b/crates/apollo-compiler/src/ast/mod.rs
@@ -31,10 +31,8 @@
 //! that has chaining methods for setting serialization configuration,
 //! and also implements `Display` and `ToString`.
 
-use crate::FileId;
 use crate::Node;
 use crate::NodeStr;
-use crate::SourceFile;
 use std::collections::HashMap;
 use std::sync::Arc;
 
@@ -47,10 +45,10 @@ pub use self::serialize::Serialize;
 #[derive(Clone)]
 pub struct Document {
     /// If this document was originally parsed from a source file,
-    /// that file and its ID.
+    /// this map contains one entry for that file and its ID.
     ///
     /// The document may have been modified since.
-    pub source: Option<(FileId, Arc<SourceFile>)>,
+    pub sources: crate::SourceMap,
 
     pub definitions: Vec<Definition>,
 }
diff --git a/crates/apollo-compiler/src/database/repr.rs b/crates/apollo-compiler/src/database/repr.rs
index a977565..a59e367 100644
--- a/crates/apollo-compiler/src/database/repr.rs
+++ b/crates/apollo-compiler/src/database/repr.rs
@@ -56,11 +56,18 @@ fn executable_document(db: &dyn ReprDatabase, file_id: FileId) -> Arc<crate::Exe
         &db.ast(file_id),
         type_system_definitions_are_errors,
     );
-    if source_type == SourceType::Document {
-        if let Some((_, source_file)) = &mut executable.source {
-            // The same parse errors will be in db.schema().sources,
-            // so they would be redundant here.
-            Arc::make_mut(source_file).parse_errors = Vec::new()
+    if source_type == SourceType::Document
+        && executable
+            .sources
+            .iter()
+            .any(|(_id, file)| !file.parse_errors.is_empty())
+    {
+        // Remove parse errors from `executable`, redudant as `schema` has the same ones
+        let sources = Arc::make_mut(&mut executable.sources);
+        for (_id, file) in sources.iter_mut() {
+            if !file.parse_errors.is_empty() {
+                Arc::make_mut(file).parse_errors = Vec::new()
+            }
         }
     }
     Arc::new(executable)
diff --git a/crates/apollo-compiler/src/executable/from_ast.rs b/crates/apollo-compiler/src/executable/from_ast.rs
index fd0234b..0e034d3 100644
--- a/crates/apollo-compiler/src/executable/from_ast.rs
+++ b/crates/apollo-compiler/src/executable/from_ast.rs
@@ -88,7 +88,7 @@ pub(crate) fn document_from_ast(
         }
     }
     ExecutableDocument {
-        source: document.source.clone(),
+        sources: document.sources.clone(),
         build_errors: errors.errors,
         named_operations,
         anonymous_operation,
diff --git a/crates/apollo-compiler/src/executable/mod.rs b/crates/apollo-compiler/src/executable/mod.rs
index d6fc968..a8bc010 100644
--- a/crates/apollo-compiler/src/executable/mod.rs
+++ b/crates/apollo-compiler/src/executable/mod.rs
@@ -3,16 +3,13 @@
 
 use crate::ast;
 use crate::schema;
-use crate::FileId;
 use crate::Node;
 use crate::Parser;
 use crate::Schema;
-use crate::SourceFile;
 use indexmap::map::Entry;
 use indexmap::IndexMap;
 use std::collections::HashSet;
 use std::path::Path;
-use std::sync::Arc;
 
 pub(crate) mod from_ast;
 mod serialize;
@@ -30,10 +27,10 @@ use std::fmt;
 #[derive(Debug, Clone, Default)]
 pub struct ExecutableDocument {
     /// If this document was originally parsed from a source file,
-    /// that file and its ID.
+    /// this map contains one entry for that file and its ID.
     ///
     /// The document may have been modified since.
-    pub source: Option<(FileId, Arc<SourceFile>)>,
+    pub sources: crate::SourceMap,
 
     /// Errors that occurred when building this document,
     /// either parsing a source file or converting from AST.
@@ -49,10 +46,10 @@ pub struct ExecutableDocument {
 #[derive(Debug, Clone)]
 pub struct FieldSet {
     /// If this document was originally parsed from a source file,
-    /// that file and its ID.
+    /// this map contains one entry for that file and its ID.
     ///
     /// The document may have been modified since.
-    pub source: Option<(FileId, Arc<SourceFile>)>,
+    pub sources: crate::SourceMap,
 
     /// Errors that occurred when building this FieldSet,
     /// either parsing a source file or converting from AST.
@@ -234,9 +231,7 @@ impl ExecutableDocument {
     }
 
     pub fn validate(&self, schema: &Schema) -> Result<(), Diagnostics> {
-        let mut sources = schema.sources.clone();
-        sources.extend(self.source.clone());
-        let mut errors = Diagnostics::new(sources);
+        let mut errors = Diagnostics::new(Some(schema.sources.clone()), self.sources.clone());
         validation::validate_executable_document(&mut errors, schema, self);
         errors.into_result()
     }
@@ -315,11 +310,11 @@ impl ExecutableDocument {
 
 impl Eq for ExecutableDocument {}
 
-/// `source` and `build_errors` are ignored for comparison
+/// `sources` and `build_errors` are ignored for comparison
 impl PartialEq for ExecutableDocument {
     fn eq(&self, other: &Self) -> bool {
         let Self {
-            source: _,
+            sources: _,
             build_errors: _,
             anonymous_operation,
             named_operations,
@@ -707,9 +702,7 @@ impl FieldSet {
     }
 
     pub fn validate(&self, schema: &Schema) -> Result<(), Diagnostics> {
-        let mut sources = schema.sources.clone();
-        sources.extend(self.source.clone());
-        let mut errors = Diagnostics::new(sources);
+        let mut errors = Diagnostics::new(Some(schema.sources.clone()), self.sources.clone());
         validation::validate_field_set(&mut errors, schema, self);
         errors.into_result()
     }
diff --git a/crates/apollo-compiler/src/executable/validation.rs b/crates/apollo-compiler/src/executable/validation.rs
index fe9a695..9073dbd 100644
--- a/crates/apollo-compiler/src/executable/validation.rs
+++ b/crates/apollo-compiler/src/executable/validation.rs
@@ -29,7 +29,7 @@ pub(crate) fn validate_standalone_executable(
 }
 
 pub(crate) fn validate_common(errors: &mut Diagnostics, document: &ExecutableDocument) {
-    if let Some((file_id, source)) = &document.source {
+    for (file_id, source) in document.sources.iter() {
         source.validate_parse_errors(errors, *file_id)
     }
     for build_error in &document.build_errors {
@@ -79,12 +79,12 @@ fn compiler_validation(
     let mut compiler = crate::ApolloCompiler::new();
     let mut ids = Vec::new();
     if let Some(schema) = schema {
-        for (id, source) in &schema.sources {
+        for (id, source) in schema.sources.iter() {
             ids.push(*id);
             compiler.db.set_input(*id, source.into());
         }
     }
-    if let Some((id, source)) = &document.source {
+    for (id, source) in document.sources.iter() {
         ids.push(*id);
         compiler.db.set_input(*id, source.into());
     }
@@ -132,7 +132,7 @@ fn compiler_validation(
 }
 
 pub(crate) fn validate_field_set(errors: &mut Diagnostics, schema: &Schema, field_set: &FieldSet) {
-    if let Some((file_id, source)) = &field_set.source {
+    for (file_id, source) in &*field_set.sources {
         source.validate_parse_errors(errors, *file_id)
     }
     for build_error in &field_set.build_errors {
@@ -140,11 +140,11 @@ pub(crate) fn validate_field_set(errors: &mut Diagnostics, schema: &Schema, fiel
     }
     let mut compiler = crate::ApolloCompiler::new();
     let mut ids = Vec::new();
-    for (id, source) in &schema.sources {
+    for (id, source) in &*schema.sources {
         ids.push(*id);
         compiler.db.set_input(*id, source.into());
     }
-    if let Some((id, source)) = &field_set.source {
+    for (id, source) in &*field_set.sources {
         ids.push(*id);
         compiler.db.set_input(*id, source.into());
     }
diff --git a/crates/apollo-compiler/src/lib.rs b/crates/apollo-compiler/src/lib.rs
index d7282c6..52c380d 100644
--- a/crates/apollo-compiler/src/lib.rs
+++ b/crates/apollo-compiler/src/lib.rs
@@ -20,7 +20,7 @@ pub use self::database::FileId;
 pub use self::executable::ExecutableDocument;
 pub use self::node::{Node, NodeLocation};
 pub use self::node_str::NodeStr;
-pub use self::parser::{parse_mixed, Parser, SourceFile};
+pub use self::parser::{parse_mixed, Parser, SourceFile, SourceMap};
 pub use self::schema::Schema;
 pub use self::validation::Diagnostics;
 
diff --git a/crates/apollo-compiler/src/parser.rs b/crates/apollo-compiler/src/parser.rs
index 79828d8..1674af6 100644
--- a/crates/apollo-compiler/src/parser.rs
+++ b/crates/apollo-compiler/src/parser.rs
@@ -8,9 +8,11 @@ use crate::ExecutableDocument;
 use crate::FileId;
 use crate::NodeLocation;
 use crate::Schema;
+use indexmap::IndexMap;
 use std::path::Path;
 use std::path::PathBuf;
 use std::sync::Arc;
+use std::sync::OnceLock;
 
 /// Configuration for parsing an input string as GraphQL syntax
 #[derive(Default, Debug, Clone)]
@@ -27,8 +29,11 @@ pub struct SourceFile {
     pub(crate) path: PathBuf,
     pub(crate) source_text: String,
     pub(crate) parse_errors: Vec<apollo_parser::Error>,
+    pub(crate) ariadne: OnceLock<ariadne::Source>,
 }
 
+pub type SourceMap = Arc<IndexMap<FileId, Arc<SourceFile>>>;
+
 /// Parse a schema and executable document from the given source text
 /// containing a mixture of type system definitions and executable definitions.
 /// This is mostly useful for unit tests.
@@ -110,6 +115,7 @@ impl Parser {
             path,
             source_text,
             parse_errors: tree.errors().cloned().collect(),
+            ariadne: OnceLock::new(),
         });
         (tree, source_file)
     }
@@ -216,7 +222,7 @@ impl Parser {
         };
         selection_set.extend_from_ast(Some(schema), &mut build_errors, &ast);
         executable::FieldSet {
-            source: Some((file_id, source_file)),
+            sources: Arc::new([(file_id, source_file)].into()),
             build_errors: build_errors.errors,
             selection_set,
         }
@@ -250,6 +256,11 @@ impl SourceFile {
         &self.source_text
     }
 
+    pub fn ariadne(&self) -> &ariadne::Source {
+        self.ariadne
+            .get_or_init(|| ariadne::Source::from(&self.source_text))
+    }
+
     pub(crate) fn validate_parse_errors(&self, errors: &mut Diagnostics, file_id: FileId) {
         for err in &self.parse_errors {
             // Silently skip parse errors at index beyond 4 GiB.
@@ -285,6 +296,7 @@ impl std::fmt::Debug for SourceFile {
             path,
             source_text,
             parse_errors,
+            ariadne: _, // Skipped: it’s a cache and would make debugging other things noisy
         } = self;
         let mut debug_struct = f.debug_struct("SourceFile");
         debug_struct.field("path", path);
diff --git a/crates/apollo-compiler/src/schema/from_ast.rs b/crates/apollo-compiler/src/schema/from_ast.rs
index 0e9f660..fd9847a 100644
--- a/crates/apollo-compiler/src/schema/from_ast.rs
+++ b/crates/apollo-compiler/src/schema/from_ast.rs
@@ -1,5 +1,6 @@
 use super::*;
 use indexmap::map::Entry;
+use std::sync::Arc;
 
 pub struct SchemaBuilder {
     adopt_orphan_extensions: bool,
@@ -28,7 +29,7 @@ impl SchemaBuilder {
         let mut builder = SchemaBuilder {
             adopt_orphan_extensions: false,
             schema: Schema {
-                sources: IndexMap::new(),
+                sources: Default::default(),
                 build_errors: Vec::new(),
                 schema_definition: Node::new(SchemaDefinition {
                     description: None,
@@ -100,8 +101,9 @@ impl SchemaBuilder {
         document: &ast::Document,
         executable_definitions_are_errors: bool,
     ) {
-        if let Some((file_id, source_file)) = document.source.clone() {
-            self.schema.sources.insert(file_id, source_file);
+        let sources = Arc::make_mut(&mut self.schema.sources);
+        for (file_id, source_file) in document.sources.iter() {
+            sources.insert(*file_id, source_file.clone());
         }
         for definition in &document.definitions {
             match definition {
diff --git a/crates/apollo-compiler/src/schema/mod.rs b/crates/apollo-compiler/src/schema/mod.rs
index 3061913..e7f5404 100644
--- a/crates/apollo-compiler/src/schema/mod.rs
+++ b/crates/apollo-compiler/src/schema/mod.rs
@@ -6,13 +6,11 @@ use crate::Node;
 use crate::NodeLocation;
 use crate::NodeStr;
 use crate::Parser;
-use crate::SourceFile;
 use indexmap::IndexMap;
 use indexmap::IndexSet;
 use std::collections::HashMap;
 use std::collections::HashSet;
 use std::path::Path;
-use std::sync::Arc;
 use std::sync::OnceLock;
 
 mod component;
@@ -34,7 +32,7 @@ pub struct Schema {
     /// Source files, if any, that were parsed to contribute to this schema.
     ///
     /// The schema (including parsed definitions) may have been modified since parsing.
-    pub sources: IndexMap<FileId, Arc<SourceFile>>,
+    pub sources: crate::SourceMap,
 
     /// Errors that occurred when building this schema,
     /// either parsing a source file or converting from AST.
@@ -312,7 +310,7 @@ impl Schema {
 
     /// Returns `Err` if invalid, or `Ok` for potential warnings or advice
     pub fn validate(&self) -> Result<Diagnostics, Diagnostics> {
-        let mut errors = Diagnostics::new(self.sources.clone());
+        let mut errors = Diagnostics::new(None, self.sources.clone());
         let warnings_and_advice = validation::validate_schema(&mut errors, self);
         let valid = errors.is_empty();
         for diagnostic in warnings_and_advice {
diff --git a/crates/apollo-compiler/src/schema/validation.rs b/crates/apollo-compiler/src/schema/validation.rs
index 0bc6d85..e3c03fc 100644
--- a/crates/apollo-compiler/src/schema/validation.rs
+++ b/crates/apollo-compiler/src/schema/validation.rs
@@ -11,7 +11,7 @@ pub(crate) fn validate_schema(
     errors: &mut Diagnostics,
     schema: &Schema,
 ) -> Vec<crate::ApolloDiagnostic> {
-    for (&file_id, source) in &schema.sources {
+    for (&file_id, source) in schema.sources.iter() {
         source.validate_parse_errors(errors, file_id)
     }
     for build_error in &schema.build_errors {
@@ -47,7 +47,7 @@ fn validate_build_error(errors: &mut Diagnostics, build_error: &BuildError) {
 fn compiler_validation(errors: &mut Diagnostics, schema: &Schema) -> Vec<crate::ApolloDiagnostic> {
     let mut compiler = crate::ApolloCompiler::new();
     let mut ids = Vec::new();
-    for (id, source) in &schema.sources {
+    for (id, source) in schema.sources.iter() {
         ids.push(*id);
         compiler.db.set_input(*id, source.into());
     }
diff --git a/crates/apollo-compiler/src/validation/mod.rs b/crates/apollo-compiler/src/validation/mod.rs
index e1c46b2..d9d7b0e 100644
--- a/crates/apollo-compiler/src/validation/mod.rs
+++ b/crates/apollo-compiler/src/validation/mod.rs
@@ -22,35 +22,39 @@ use crate::FileId;
 use crate::NodeLocation;
 use crate::NodeStr;
 use crate::SourceFile;
-use indexmap::IndexMap;
+use crate::SourceMap;
 use indexmap::IndexSet;
-use std::cell::RefCell;
-use std::collections::hash_map::Entry;
-use std::collections::HashMap;
 use std::fmt;
 use std::io;
 use std::sync::Arc;
+use std::sync::OnceLock;
 pub(crate) use validation_db::{ValidationDatabase, ValidationStorage};
 
+/// A collection of diagnostics returned by some validation method
 pub struct Diagnostics(Box<DiagnosticsBoxed>);
 
 /// Box indirection to avoid large `Err` values:
 /// <https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err>
 struct DiagnosticsBoxed {
-    source_cache: RefCell<SourceCache>,
-    errors: Vec<Error>,
+    sources: Sources,
+    diagnostics_data: Vec<DiagnosticData>,
 }
 
-struct SourceCache {
-    sources: IndexMap<FileId, Arc<SourceFile>>,
-    cache: HashMap<FileId, ariadne::Source>,
+struct Sources {
+    schema_sources: Option<SourceMap>,
+    self_sources: SourceMap,
 }
 
-struct Error {
+struct DiagnosticData {
     location: Option<NodeLocation>,
     details: Details,
 }
 
+pub struct Diagnostic<'a> {
+    sources: &'a Sources,
+    data: &'a DiagnosticData,
+}
+
 #[derive(thiserror::Error, Debug)]
 pub(crate) enum Details {
     #[error("{message}")]
@@ -65,7 +69,7 @@ pub(crate) enum Details {
     CompilerDiagnostic(crate::ApolloDiagnostic),
 }
 
-impl Error {
+impl DiagnosticData {
     fn report(&self, color: bool) -> ariadne::Report<'static, NodeLocation> {
         let config = ariadne::Config::default().with_color(color);
         if let Details::CompilerDiagnostic(diagnostic) = &self.details {
@@ -263,6 +267,23 @@ impl Error {
 }
 
 impl Diagnostics {
+    pub fn is_empty(&self) -> bool {
+        self.0.diagnostics_data.is_empty()
+    }
+
+    pub fn len(&self) -> usize {
+        self.0.diagnostics_data.len()
+    }
+
+    pub fn iter(
+        &self,
+    ) -> impl Iterator<Item = Diagnostic<'_>> + DoubleEndedIterator + ExactSizeIterator {
+        self.0.diagnostics_data.iter().map(|data| Diagnostic {
+            sources: &self.0.sources,
+            data,
+        })
+    }
+
     /// Returns a human-readable string formatting, without color codes regardless of stderr.
     ///
     /// `Display` and `.to_string()` are meant for printing to stderr,
@@ -271,22 +292,24 @@ impl Diagnostics {
         format!("{self:#}")
     }
 
-    pub(crate) fn new(sources: IndexMap<FileId, Arc<SourceFile>>) -> Self {
+    pub(crate) fn new(schema_sources: Option<SourceMap>, self_sources: SourceMap) -> Self {
         Self(Box::new(DiagnosticsBoxed {
-            errors: Vec::new(),
-            source_cache: RefCell::new(SourceCache {
-                sources,
-                cache: HashMap::new(),
-            }),
+            sources: Sources {
+                schema_sources,
+                self_sources,
+            },
+            diagnostics_data: Vec::new(),
         }))
     }
 
     pub(crate) fn push(&mut self, location: Option<NodeLocation>, details: Details) {
-        self.0.errors.push(Error { location, details })
+        self.0
+            .diagnostics_data
+            .push(DiagnosticData { location, details })
     }
 
     pub(crate) fn into_result(mut self) -> Result<(), Self> {
-        if self.0.errors.is_empty() {
+        if self.0.diagnostics_data.is_empty() {
             Ok(())
         } else {
             self.sort();
@@ -296,17 +319,27 @@ impl Diagnostics {
 
     pub(crate) fn sort(&mut self) {
         self.0
-            .errors
+            .diagnostics_data
             .sort_by_key(|err| err.location.map(|loc| (loc.file_id(), loc.offset())))
     }
+}
 
-    pub(crate) fn is_empty(&self) -> bool {
-        self.0.errors.is_empty()
+/// Defaults to ANSI color codes if stderr is a terminal.
+///
+/// Use alternate formatting to never use colors: `format!("{diagnostics:#}")`
+impl fmt::Display for Diagnostics {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        for diagnostic in self.iter() {
+            diagnostic.fmt(f)?
+        }
+        Ok(())
     }
 }
 
-/// Use alternate formatting to disable colors: `format!("{validation_errors:#}")`
-impl fmt::Display for Diagnostics {
+/// Defaults to ANSI color codes if stderr is a terminal.
+///
+/// Use alternate formatting to never use colors: `format!("{diagnostic:#}")`
+impl fmt::Display for Diagnostic<'_> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         struct Adaptor<'a, 'b>(&'a mut fmt::Formatter<'b>);
 
@@ -322,19 +355,23 @@ impl fmt::Display for Diagnostics {
             }
         }
 
-        let mut cache = self.0.source_cache.borrow_mut();
         let color = !f.alternate();
-        for error in &self.0.errors {
-            error
-                .report(color)
-                .write(&mut *cache, Adaptor(f))
-                .map_err(|_| fmt::Error)?
-        }
-        Ok(())
+        self.data
+            .report(color)
+            .write(self.sources, Adaptor(f))
+            .map_err(|_| fmt::Error)
+    }
+}
+
+impl Sources {
+    pub(crate) fn get(&self, file_id: &FileId) -> Option<&Arc<SourceFile>> {
+        self.self_sources
+            .get(file_id)
+            .or_else(|| self.schema_sources.as_ref()?.get(file_id))
     }
 }
 
-impl ariadne::Cache<FileId> for SourceCache {
+impl ariadne::Cache<FileId> for &'_ Sources {
     fn fetch(&mut self, file_id: &FileId) -> Result<&ariadne::Source, Box<dyn fmt::Debug + '_>> {
         struct NotFound(FileId);
         impl fmt::Debug for NotFound {
@@ -342,21 +379,16 @@ impl ariadne::Cache<FileId> for SourceCache {
                 write!(f, "source file not found: {:?}", self.0)
             }
         }
-        match self.cache.entry(*file_id) {
-            Entry::Occupied(entry) => Ok(entry.into_mut()),
-            Entry::Vacant(entry) => {
-                let source_text = if *file_id == FileId::NONE
-                    || *file_id == FileId::HACK_TMP
-                    || *file_id == FileId::HACK_TMP_2
-                {
-                    ""
-                } else if let Some(file) = self.sources.get(file_id) {
-                    file.source_text()
-                } else {
-                    return Err(Box::new(NotFound(*file_id)));
-                };
-                Ok(entry.insert(ariadne::Source::from(source_text)))
-            }
+        if let Some(source_file) = self.get(file_id) {
+            Ok(source_file.ariadne())
+        } else if *file_id == FileId::NONE
+            || *file_id == FileId::HACK_TMP
+            || *file_id == FileId::HACK_TMP_2
+        {
+            static EMPTY: OnceLock<ariadne::Source> = OnceLock::new();
+            Ok(EMPTY.get_or_init(|| ariadne::Source::from("")))
+        } else {
+            Err(Box::new(NotFound(*file_id)))
         }
     }
 
@@ -368,7 +400,7 @@ impl ariadne::Cache<FileId> for SourceCache {
                     self.0.path().display().fmt(f)
                 }
             }
-            let source_file = self.sources.get(file_id)?;
+            let source_file = self.get(file_id)?;
             Some(Box::new(Path(source_file.clone())))
         } else {
             struct NoSourceFile;


Test patch:
diff --git a/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt b/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt
index 5f71874..e331191 100644
--- a/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt
+++ b/crates/apollo-compiler/test_data/ok/0001_annonymous_operation_definition.txt
@@ -89,16 +89,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            1,
-            SourceFile {
-                path: "0001_annonymous_operation_definition.graphql",
-                source_text: "\nquery {\n  cat {\n    name\n  }\n}\n\ntype Query {\n  cat: Pet\n}\n\ntype Pet {\n  name: String\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        1: SourceFile {
+            path: "0001_annonymous_operation_definition.graphql",
+            source_text: "\nquery {\n  cat {\n    name\n  }\n}\n\ntype Query {\n  cat: Pet\n}\n\ntype Pet {\n  name: String\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         1..31 @1 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt b/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt
index 20c187d..98941d8 100644
--- a/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt
+++ b/crates/apollo-compiler/test_data/ok/0002_multiple_named_operation_definitions.txt
@@ -122,16 +122,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            2,
-            SourceFile {
-                path: "0002_multiple_named_operation_definitions.graphql",
-                source_text: "query getCatName {\n  cat {\n    name\n  }\n}\n\nquery getOwnerName {\n  cat {\n    owner {\n      name\n    }\n  }\n}\n\n\ntype Query {\n  cat: Pet\n}\n\ntype Pet {\n  name: String,\n  owner: PetOwner\n}\n\ntype PetOwner {\n  name: String\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        2: SourceFile {
+            path: "0002_multiple_named_operation_definitions.graphql",
+            source_text: "query getCatName {\n  cat {\n    name\n  }\n}\n\nquery getOwnerName {\n  cat {\n    owner {\n      name\n    }\n  }\n}\n\n\ntype Query {\n  cat: Pet\n}\n\ntype Pet {\n  name: String,\n  owner: PetOwner\n}\n\ntype PetOwner {\n  name: String\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0003_schema_definition_with_custom_operation_types.txt b/crates/apollo-compiler/test_data/ok/0003_schema_definition_with_custom_operation_types.txt
index dc4d59b..5437d12 100644
--- a/crates/apollo-compiler/test_data/ok/0003_schema_definition_with_custom_operation_types.txt
+++ b/crates/apollo-compiler/test_data/ok/0003_schema_definition_with_custom_operation_types.txt
@@ -196,16 +196,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            3,
-            SourceFile {
-                path: "0003_schema_definition_with_custom_operation_types.graphql",
-                source_text: "schema {\n  query: customPetQuery,\n  subscription: customPetSubscription\n  mutation: customPetMutation\n}\n\nenum PetType {\n  CAT,\n  DOG,\n}\n\ntype customPetQuery {\n  name: String,\n  age: Int\n}\n\ntype customPetSubscription {\n  changeInPetHousehold: Result\n}\n\ntype customPetMutation {\n  addPet (name: String!, petType: PetType): Result!\n}\n\ntype Result {\n  id: String\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        3: SourceFile {
+            path: "0003_schema_definition_with_custom_operation_types.graphql",
+            source_text: "schema {\n  query: customPetQuery,\n  subscription: customPetSubscription\n  mutation: customPetMutation\n}\n\nenum PetType {\n  CAT,\n  DOG,\n}\n\ntype customPetQuery {\n  name: String,\n  age: Int\n}\n\ntype customPetSubscription {\n  changeInPetHousehold: Result\n}\n\ntype customPetMutation {\n  addPet (name: String!, petType: PetType): Result!\n}\n\ntype Result {\n  id: String\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0004_schema_with_custom_scalars.txt b/crates/apollo-compiler/test_data/ok/0004_schema_with_custom_scalars.txt
index dbe1bf6..3912398 100644
--- a/crates/apollo-compiler/test_data/ok/0004_schema_with_custom_scalars.txt
+++ b/crates/apollo-compiler/test_data/ok/0004_schema_with_custom_scalars.txt
@@ -101,16 +101,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            4,
-            SourceFile {
-                path: "0004_schema_with_custom_scalars.graphql",
-                source_text: "type Query {\n  website: URL,\n  amount: Int\n}\n\nscalar URL @specifiedBy(url: \"https://tools.ietf.org/html/rfc3986\")",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        4: SourceFile {
+            path: "0004_schema_with_custom_scalars.graphql",
+            source_text: "type Query {\n  website: URL,\n  amount: Int\n}\n\nscalar URL @specifiedBy(url: \"https://tools.ietf.org/html/rfc3986\")",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0005_schema_with_valid_enum_definitions.txt b/crates/apollo-compiler/test_data/ok/0005_schema_with_valid_enum_definitions.txt
index 8595813..524fc1d 100644
--- a/crates/apollo-compiler/test_data/ok/0005_schema_with_valid_enum_definitions.txt
+++ b/crates/apollo-compiler/test_data/ok/0005_schema_with_valid_enum_definitions.txt
@@ -144,16 +144,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            5,
-            SourceFile {
-                path: "0005_schema_with_valid_enum_definitions.graphql",
-                source_text: "type Query {\n  pet: Pet,\n  snacks: Snack,\n}\n\nenum Pet {\n    CAT\n    DOG\n    FOX\n}\n\nenum Snack {\n    THRIVE_PET_FOODS\n    LILYS_KITCHEN\n    ACANA\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        5: SourceFile {
+            path: "0005_schema_with_valid_enum_definitions.graphql",
+            source_text: "type Query {\n  pet: Pet,\n  snacks: Snack,\n}\n\nenum Pet {\n    CAT\n    DOG\n    FOX\n}\n\nenum Snack {\n    THRIVE_PET_FOODS\n    LILYS_KITCHEN\n    ACANA\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0006_schema_with_valid_union.txt b/crates/apollo-compiler/test_data/ok/0006_schema_with_valid_union.txt
index 5c54645..5aebb1a 100644
--- a/crates/apollo-compiler/test_data/ok/0006_schema_with_valid_union.txt
+++ b/crates/apollo-compiler/test_data/ok/0006_schema_with_valid_union.txt
@@ -150,16 +150,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            6,
-            SourceFile {
-                path: "0006_schema_with_valid_union.graphql",
-                source_text: "schema {\n  query: SearchQuery\n}\n\nunion SearchResult = Photo | Person\n\ntype Person {\n  name: String\n  age: Int\n}\n\ntype Photo {\n  height: Int\n  width: Int\n}\n\ntype SearchQuery {\n  firstSearchResult: SearchResult\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        6: SourceFile {
+            path: "0006_schema_with_valid_union.graphql",
+            source_text: "schema {\n  query: SearchQuery\n}\n\nunion SearchResult = Photo | Person\n\ntype Person {\n  name: String\n  age: Int\n}\n\ntype Photo {\n  height: Int\n  width: Int\n}\n\ntype SearchQuery {\n  firstSearchResult: SearchResult\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0007_schema_with_interface_definition.txt b/crates/apollo-compiler/test_data/ok/0007_schema_with_interface_definition.txt
index bf694d6..8723776 100644
--- a/crates/apollo-compiler/test_data/ok/0007_schema_with_interface_definition.txt
+++ b/crates/apollo-compiler/test_data/ok/0007_schema_with_interface_definition.txt
@@ -210,16 +210,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            7,
-            SourceFile {
-                path: "0007_schema_with_interface_definition.graphql",
-                source_text: "type Query implements Node {\n    id: ID!\n}\n\ninterface Node {\n  id: ID!\n}\n\ninterface Resource implements Node {\n  id: ID!\n  width: Int\n  height: Int\n}\n\ninterface Image implements Resource & Node {\n  id: ID!\n  width: Int\n  height: Int\n  thumbnail: String\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        7: SourceFile {
+            path: "0007_schema_with_interface_definition.graphql",
+            source_text: "type Query implements Node {\n    id: ID!\n}\n\ninterface Node {\n  id: ID!\n}\n\ninterface Resource implements Node {\n  id: ID!\n  width: Int\n  height: Int\n}\n\ninterface Image implements Resource & Node {\n  id: ID!\n  width: Int\n  height: Int\n  thumbnail: String\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0008_schema_with_directive_definition.txt b/crates/apollo-compiler/test_data/ok/0008_schema_with_directive_definition.txt
index c098a3f..9b21aa4 100644
--- a/crates/apollo-compiler/test_data/ok/0008_schema_with_directive_definition.txt
+++ b/crates/apollo-compiler/test_data/ok/0008_schema_with_directive_definition.txt
@@ -138,16 +138,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            8,
-            SourceFile {
-                path: "0008_schema_with_directive_definition.graphql",
-                source_text: "type Query {\n    literature: Book\n}\n\ndirective @delegateField(name: String!) repeatable on OBJECT | INTERFACE\n\ntype Book @delegateField(name: \"pageCount\") @delegateField(name: \"author\") {\n  id: ID!\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        8: SourceFile {
+            path: "0008_schema_with_directive_definition.graphql",
+            source_text: "type Query {\n    literature: Book\n}\n\ndirective @delegateField(name: String!) repeatable on OBJECT | INTERFACE\n\ntype Book @delegateField(name: \"pageCount\") @delegateField(name: \"author\") {\n  id: ID!\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0009_schema_with_input_object.txt b/crates/apollo-compiler/test_data/ok/0009_schema_with_input_object.txt
index d09350b..a76682e 100644
--- a/crates/apollo-compiler/test_data/ok/0009_schema_with_input_object.txt
+++ b/crates/apollo-compiler/test_data/ok/0009_schema_with_input_object.txt
@@ -133,16 +133,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            9,
-            SourceFile {
-                path: "0009_schema_with_input_object.graphql",
-                source_text: "type Query {\n  website: URL,\n  amount: Int\n}\n\nscalar URL @specifiedBy(url: \"https://tools.ietf.org/html/rfc3986\")\n\ninput Point2D {\n  x: Float\n  y: Float\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        9: SourceFile {
+            path: "0009_schema_with_input_object.graphql",
+            source_text: "type Query {\n  website: URL,\n  amount: Int\n}\n\nscalar URL @specifiedBy(url: \"https://tools.ietf.org/html/rfc3986\")\n\ninput Point2D {\n  x: Float\n  y: Float\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt b/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt
index 83f1fd6..8180792 100644
--- a/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt
+++ b/crates/apollo-compiler/test_data/ok/0010_operation_with_defined_fields.txt
@@ -240,16 +240,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            10,
-            SourceFile {
-                path: "0010_operation_with_defined_fields.graphql",
-                source_text: "query getProduct {\n  size\n  topProducts {\n    name\n    inStock\n  }\n}\n\ntype Query {\n  topProducts: Product\n  name: String\n  size: Int\n}\n\ntype Product {\n  inStock: Boolean @join__field(graph: INVENTORY)\n  name: String @join__field(graph: PRODUCTS)\n  price: Int\n  shippingEstimate: Int\n  upc: String!\n  weight: Int\n}\n\ndirective @join__field(graph: join__Graph) on FIELD_DEFINITION\nenum join__Graph {\n  INVENTORY,\n  PRODUCTS,\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        10: SourceFile {
+            path: "0010_operation_with_defined_fields.graphql",
+            source_text: "query getProduct {\n  size\n  topProducts {\n    name\n    inStock\n  }\n}\n\ntype Query {\n  topProducts: Product\n  name: String\n  size: Int\n}\n\ntype Product {\n  inStock: Boolean @join__field(graph: INVENTORY)\n  name: String @join__field(graph: PRODUCTS)\n  price: Int\n  shippingEstimate: Int\n  upc: String!\n  weight: Int\n}\n\ndirective @join__field(graph: join__Graph) on FIELD_DEFINITION\nenum join__Graph {\n  INVENTORY,\n  PRODUCTS,\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt b/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt
index dc7e62e..216c404 100644
--- a/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt
+++ b/crates/apollo-compiler/test_data/ok/0011_fragment_spreads_in_fragment_definitions.txt
@@ -110,16 +110,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            11,
-            SourceFile {
-                path: "0011_fragment_spreads_in_fragment_definitions.graphql",
-                source_text: "query IntrospectionQuery {\n  foo {\n    ...Bar\n  }\n}\n\nfragment Bar on Foo {\n  baz {\n    ...Quux\n  }\n}\n\nfragment Quux on Baz {\n  id\n}\n\ntype Query {\n  foo: Foo\n}\n\ntype Foo {\n  baz: Baz\n}\n\ntype Baz {\n  id: ID\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        11: SourceFile {
+            path: "0011_fragment_spreads_in_fragment_definitions.graphql",
+            source_text: "query IntrospectionQuery {\n  foo {\n    ...Bar\n  }\n}\n\nfragment Bar on Foo {\n  baz {\n    ...Quux\n  }\n}\n\nfragment Quux on Baz {\n  id\n}\n\ntype Query {\n  foo: Foo\n}\n\ntype Foo {\n  baz: Baz\n}\n\ntype Baz {\n  id: ID\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt b/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt
index 54e4fb1..6b7282b 100644
--- a/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt
+++ b/crates/apollo-compiler/test_data/ok/0012_introspection_query.txt
@@ -68,16 +68,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            12,
-            SourceFile {
-                path: "0012_introspection_query.graphql",
-                source_text: "query IntrospectionQuery {\n  __schema {\n    queryType { name }\n    mutationType { name }\n    subscriptionType { name }\n    types {\n      ...FullType\n    }\n    directives {\n      name\n      description\n      locations\n      args {\n        ...InputValue\n      }\n    }\n  }\n}\nfragment FullType on __Type {\n  kind\n  name\n  description\n  fields(includeDeprecated: true) {\n    name\n    description\n    args {\n      ...InputValue\n    }\n    type {\n      ...TypeRef\n    }\n    isDeprecated\n    deprecationReason\n  }\n  inputFields {\n    ...InputValue\n  }\n  interfaces {\n    ...TypeRef\n  }\n  enumValues(includeDeprecated: true) {\n    name\n    description\n    isDeprecated\n    deprecationReason\n  }\n  possibleTypes {\n    ...TypeRef\n  }\n}\nfragment InputValue on __InputValue {\n  name\n  description\n  type { ...TypeRef }\n  defaultValue\n}\nfragment TypeRef on __Type {\n  kind\n  name\n  ofType {\n    kind\n    name\n    ofType {\n      kind\n      name\n      ofType {\n        kind\n        name\n        ofType {\n          kind\n          name\n          ofType {\n            kind\n            name\n            ofType {\n              kind\n              name\n              ofType {\n                kind\n                name\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\ntype Query {\n  field: Int\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        12: SourceFile {
+            path: "0012_introspection_query.graphql",
+            source_text: "query IntrospectionQuery {\n  __schema {\n    queryType { name }\n    mutationType { name }\n    subscriptionType { name }\n    types {\n      ...FullType\n    }\n    directives {\n      name\n      description\n      locations\n      args {\n        ...InputValue\n      }\n    }\n  }\n}\nfragment FullType on __Type {\n  kind\n  name\n  description\n  fields(includeDeprecated: true) {\n    name\n    description\n    args {\n      ...InputValue\n    }\n    type {\n      ...TypeRef\n    }\n    isDeprecated\n    deprecationReason\n  }\n  inputFields {\n    ...InputValue\n  }\n  interfaces {\n    ...TypeRef\n  }\n  enumValues(includeDeprecated: true) {\n    name\n    description\n    isDeprecated\n    deprecationReason\n  }\n  possibleTypes {\n    ...TypeRef\n  }\n}\nfragment InputValue on __InputValue {\n  name\n  description\n  type { ...TypeRef }\n  defaultValue\n}\nfragment TypeRef on __Type {\n  kind\n  name\n  ofType {\n    kind\n    name\n    ofType {\n      kind\n      name\n      ofType {\n        kind\n        name\n        ofType {\n          kind\n          name\n          ofType {\n            kind\n            name\n            ofType {\n              kind\n              name\n              ofType {\n                kind\n                name\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\ntype Query {\n  field: Int\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt b/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt
index b1f46d1..c876a32 100644
--- a/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt
+++ b/crates/apollo-compiler/test_data/ok/0013_operation_with_used_variable_in_fragment.txt
@@ -197,16 +197,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            13,
-            SourceFile {
-                path: "0013_operation_with_used_variable_in_fragment.graphql",
-                source_text: "query ExampleQuery($variable: Int) {\n  topProducts {\n    name\n  }\n  ... subFrag\n}\n\nfragment subFrag on Query {\n  topProducts {\n    price(setPrice: $variable)\n  }\n}\n\ntype Query {\n  topProducts(first: Int): Product,\n  reviews: Review\n}\n\ntype Review {\n  message: Message\n}\n\ntype Message {\n  body: String\n  sender(attribute: String): String\n}\n\ntype Product {\n  name: String\n  price(setPrice: Int): Int\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        13: SourceFile {
+            path: "0013_operation_with_used_variable_in_fragment.graphql",
+            source_text: "query ExampleQuery($variable: Int) {\n  topProducts {\n    name\n  }\n  ... subFrag\n}\n\nfragment subFrag on Query {\n  topProducts {\n    price(setPrice: $variable)\n  }\n}\n\ntype Query {\n  topProducts(first: Int): Product,\n  reviews: Review\n}\n\ntype Review {\n  message: Message\n}\n\ntype Message {\n  body: String\n  sender(attribute: String): String\n}\n\ntype Product {\n  name: String\n  price(setPrice: Int): Int\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0014_float_values.txt b/crates/apollo-compiler/test_data/ok/0014_float_values.txt
index 46149d7..d8c89f7 100644
--- a/crates/apollo-compiler/test_data/ok/0014_float_values.txt
+++ b/crates/apollo-compiler/test_data/ok/0014_float_values.txt
@@ -162,16 +162,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            14,
-            SourceFile {
-                path: "0014_float_values.graphql",
-                source_text: "type Query {\n  name(arg: WithAllKindsOfFloats): String\n}\n\ninput WithAllKindsOfFloats {\n  a_regular_float: Float = 1.2\n  an_integer_float: Float = 1234\n  a_float_that_doesnt_fit_an_int: Float = 9876543210\n  list_of_floats: [Float] = [4, 9876543210, 98765432109876543210]\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        14: SourceFile {
+            path: "0014_float_values.graphql",
+            source_text: "type Query {\n  name(arg: WithAllKindsOfFloats): String\n}\n\ninput WithAllKindsOfFloats {\n  a_regular_float: Float = 1.2\n  an_integer_float: Float = 1234\n  a_float_that_doesnt_fit_an_int: Float = 9876543210\n  list_of_floats: [Float] = [4, 9876543210, 98765432109876543210]\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0015_supergraph.txt b/crates/apollo-compiler/test_data/ok/0015_supergraph.txt
index 7c47122..90b29c9 100644
--- a/crates/apollo-compiler/test_data/ok/0015_supergraph.txt
+++ b/crates/apollo-compiler/test_data/ok/0015_supergraph.txt
@@ -3751,16 +3751,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            15,
-            SourceFile {
-                path: "0015_supergraph.graphql",
-                source_text: "schema\n@core(feature: \"https://specs.apollo.dev/core/v0.1\"),\n@core(feature: \"https://specs.apollo.dev/join/v0.1\")\n{\n  query: Query\n  mutation: Mutation\n}\n\ndirective @core(feature: String!) repeatable on SCHEMA\ndirective @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet) on FIELD_DEFINITION\ndirective @join__type(graph: join__Graph!, key: join__FieldSet) repeatable on OBJECT | INTERFACE\ndirective @join__owner(graph: join__Graph!) on OBJECT | INTERFACE\ndirective @join__graph(name: String!, url: String!) on ENUM_VALUE\ndirective @stream on FIELD\ndirective @transform(from: String!) on FIELD\n\nunion AccountType = PasswordAccount | SMSAccount\n\ntype Amazon {\n  referrer: String\n}\n\nunion Body = Image | Text\n\ntype Book implements Product\n@join__owner(graph: BOOKS)\n@join__type(graph: BOOKS, key: \"isbn\")\n@join__type(graph: INVENTORY, key: \"isbn\")\n@join__type(graph: PRODUCT, key: \"isbn\")\n@join__type(graph: REVIEWS, key: \"isbn\")\n{\n  isbn: String! @join__field(graph: BOOKS)\n  title: String @join__field(graph: BOOKS)\n  year: Int @join__field(graph: BOOKS)\n  similarBooks: [Book]! @join__field(graph: BOOKS)\n  metadata: [MetadataOrError] @join__field(graph: BOOKS)\n  inStock: Boolean @join__field(graph: INVENTORY)\n  isCheckedOut: Boolean @join__field(graph: INVENTORY)\n  upc: String! @join__field(graph: PRODUCT)\n  sku: String! @join__field(graph: PRODUCT)\n  name(delimeter: String = \" \"): String @join__field(graph: PRODUCT, requires: \"title year\")\n  price: String @join__field(graph: PRODUCT)\n  details: ProductDetailsBook @join__field(graph: PRODUCT)\n  reviews: [Review] @join__field(graph: REVIEWS)\n  relatedReviews: [Review!]! @join__field(graph: REVIEWS, requires: \"similarBooks{isbn}\")\n}\n\nunion Brand = Ikea | Amazon\n\ntype Car implements Vehicle\n@join__owner(graph: PRODUCT)\n@join__type(graph: PRODUCT, key: \"id\")\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: String! @join__field(graph: PRODUCT)\n  description: String @join__field(graph: PRODUCT)\n  price: String @join__field(graph: PRODUCT)\n  retailPrice: String @join__field(graph: REVIEWS, requires: \"price\")\n}\n\ntype Error {\n  code: Int\n  message: String\n}\n\ntype Furniture implements Product\n@join__owner(graph: PRODUCT)\n@join__type(graph: PRODUCT, key: \"upc\")\n@join__type(graph: PRODUCT, key: \"sku\")\n@join__type(graph: INVENTORY, key: \"sku\")\n@join__type(graph: REVIEWS, key: \"upc\")\n{\n  upc: String! @join__field(graph: PRODUCT)\n  sku: String! @join__field(graph: PRODUCT)\n  name: String @join__field(graph: PRODUCT)\n  price: String @join__field(graph: PRODUCT)\n  brand: Brand @join__field(graph: PRODUCT)\n  metadata: [MetadataOrError] @join__field(graph: PRODUCT)\n  details: ProductDetailsFurniture @join__field(graph: PRODUCT)\n  inStock: Boolean @join__field(graph: INVENTORY)\n  isHeavy: Boolean @join__field(graph: INVENTORY)\n  reviews: [Review] @join__field(graph: REVIEWS)\n}\n\ntype Ikea {\n  asile: Int\n}\n\ntype Image implements NamedObject {\n  name: String!\n  attributes: ImageAttributes!\n}\n\ntype ImageAttributes {\n  url: String!\n}\n\nscalar join__FieldSet @specifiedBy(url: \"https://spec.graphql.org/\")\n\nenum join__Graph {\nACCOUNTS @join__graph(name: \"accounts\" url: \"\")\nBOOKS @join__graph(name: \"books\" url: \"\")\nDOCUMENTS @join__graph(name: \"documents\" url: \"\")\nINVENTORY @join__graph(name: \"inventory\" url: \"\")\nPRODUCT @join__graph(name: \"product\" url: \"\")\nREVIEWS @join__graph(name: \"reviews\" url: \"\")\n}\n\ntype KeyValue {\n  key: String!\n  value: String!\n}\n\ntype Library\n@join__owner(graph: BOOKS)\n@join__type(graph: BOOKS, key: \"id\")\n@join__type(graph: ACCOUNTS, key: \"id\")\n{\n  id: ID! @join__field(graph: BOOKS)\n  name: String @join__field(graph: BOOKS)\n  userAccount(id: ID! = 1): User @join__field(graph: ACCOUNTS, requires: \"name\")\n}\n\nunion MetadataOrError = KeyValue | Error\n\ntype Mutation {\n  login(username: String!, password: String!): User @join__field(graph: ACCOUNTS)\n  reviewProduct(upc: String!, body: String!): Product @join__field(graph: REVIEWS)\n  updateReview(review: UpdateReviewInput!): Review @join__field(graph: REVIEWS)\n  deleteReview(id: ID!): Boolean @join__field(graph: REVIEWS)\n}\n\ntype Name {\n  first: String\n  last: String\n}\n\ninterface NamedObject {\n  name: String!\n}\n\ntype PasswordAccount\n@join__owner(graph: ACCOUNTS)\n@join__type(graph: ACCOUNTS, key: \"email\")\n{\n  email: String! @join__field(graph: ACCOUNTS)\n}\n\ninterface Product {\n  upc: String!\n  sku: String!\n  name: String\n  price: String\n  details: ProductDetails\n  inStock: Boolean\n  reviews: [Review]\n}\n\ninterface ProductDetails {\n  country: String\n}\n\ntype ProductDetailsBook implements ProductDetails {\n  country: String\n  pages: Int\n}\n\ntype ProductDetailsFurniture implements ProductDetails {\n  country: String\n  color: String\n}\n\ntype Query {\n  user(id: ID!): User @join__field(graph: ACCOUNTS)\n  me: User @join__field(graph: ACCOUNTS)\n  book(isbn: String!): Book @join__field(graph: BOOKS)\n  books: [Book] @join__field(graph: BOOKS)\n  library(id: ID!): Library @join__field(graph: BOOKS)\n  body: Body! @join__field(graph: DOCUMENTS)\n  product(upc: String!): Product @join__field(graph: PRODUCT)\n  vehicle(id: String!): Vehicle @join__field(graph: PRODUCT)\n  topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCT)\n  topCars(first: Int = 5): [Car] @join__field(graph: PRODUCT)\n  topReviews(first: Int = 5): [Review] @join__field(graph: REVIEWS)\n}\n\ntype Review\n@join__owner(graph: REVIEWS)\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: ID! @join__field(graph: REVIEWS)\n  body(format: Boolean = false): String @join__field(graph: REVIEWS)\n  author: User @join__field(graph: REVIEWS, provides: \"username\")\n  product: Product @join__field(graph: REVIEWS)\n  metadata: [MetadataOrError] @join__field(graph: REVIEWS)\n}\n\ntype SMSAccount\n@join__owner(graph: ACCOUNTS)\n@join__type(graph: ACCOUNTS, key: \"number\")\n{\n  number: String @join__field(graph: ACCOUNTS)\n}\n\ntype Text implements NamedObject {\n  name: String!\n  attributes: TextAttributes!\n}\n\ntype TextAttributes {\n  bold: Boolean\n  text: String\n}\n\nunion Thing = Car | Ikea\n\ninput UpdateReviewInput {\n  id: ID!\n  body: String\n}\n\ntype User\n@join__owner(graph: ACCOUNTS)\n@join__type(graph: ACCOUNTS, key: \"id\")\n@join__type(graph: ACCOUNTS, key: \"username name{first last}\")\n@join__type(graph: INVENTORY, key: \"id\")\n@join__type(graph: PRODUCT, key: \"id\")\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: ID! @join__field(graph: ACCOUNTS)\n  name: Name @join__field(graph: ACCOUNTS)\n  username: String @join__field(graph: ACCOUNTS)\n  birthDate(locale: String): String @join__field(graph: ACCOUNTS)\n  account: AccountType @join__field(graph: ACCOUNTS)\n  metadata: [UserMetadata] @join__field(graph: ACCOUNTS)\n  goodDescription: Boolean @join__field(graph: INVENTORY, requires: \"metadata{description}\")\n  vehicle: Vehicle @join__field(graph: PRODUCT)\n  thing: Thing @join__field(graph: PRODUCT)\n  reviews: [Review] @join__field(graph: REVIEWS)\n  numberOfReviews: Int! @join__field(graph: REVIEWS)\n  goodAddress: Boolean @join__field(graph: REVIEWS, requires: \"metadata{address}\")\n}\n\ntype UserMetadata {\n  name: String\n  address: String\n  description: String\n}\n\ntype Van implements Vehicle\n@join__owner(graph: PRODUCT)\n@join__type(graph: PRODUCT, key: \"id\")\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: String! @join__field(graph: PRODUCT)\n  description: String @join__field(graph: PRODUCT)\n  price: String @join__field(graph: PRODUCT)\n  retailPrice: String @join__field(graph: REVIEWS, requires: \"price\")\n}\n\ninterface Vehicle {\n  id: String!\n  description: String\n  price: String\n  retailPrice: String\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        15: SourceFile {
+            path: "0015_supergraph.graphql",
+            source_text: "schema\n@core(feature: \"https://specs.apollo.dev/core/v0.1\"),\n@core(feature: \"https://specs.apollo.dev/join/v0.1\")\n{\n  query: Query\n  mutation: Mutation\n}\n\ndirective @core(feature: String!) repeatable on SCHEMA\ndirective @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet) on FIELD_DEFINITION\ndirective @join__type(graph: join__Graph!, key: join__FieldSet) repeatable on OBJECT | INTERFACE\ndirective @join__owner(graph: join__Graph!) on OBJECT | INTERFACE\ndirective @join__graph(name: String!, url: String!) on ENUM_VALUE\ndirective @stream on FIELD\ndirective @transform(from: String!) on FIELD\n\nunion AccountType = PasswordAccount | SMSAccount\n\ntype Amazon {\n  referrer: String\n}\n\nunion Body = Image | Text\n\ntype Book implements Product\n@join__owner(graph: BOOKS)\n@join__type(graph: BOOKS, key: \"isbn\")\n@join__type(graph: INVENTORY, key: \"isbn\")\n@join__type(graph: PRODUCT, key: \"isbn\")\n@join__type(graph: REVIEWS, key: \"isbn\")\n{\n  isbn: String! @join__field(graph: BOOKS)\n  title: String @join__field(graph: BOOKS)\n  year: Int @join__field(graph: BOOKS)\n  similarBooks: [Book]! @join__field(graph: BOOKS)\n  metadata: [MetadataOrError] @join__field(graph: BOOKS)\n  inStock: Boolean @join__field(graph: INVENTORY)\n  isCheckedOut: Boolean @join__field(graph: INVENTORY)\n  upc: String! @join__field(graph: PRODUCT)\n  sku: String! @join__field(graph: PRODUCT)\n  name(delimeter: String = \" \"): String @join__field(graph: PRODUCT, requires: \"title year\")\n  price: String @join__field(graph: PRODUCT)\n  details: ProductDetailsBook @join__field(graph: PRODUCT)\n  reviews: [Review] @join__field(graph: REVIEWS)\n  relatedReviews: [Review!]! @join__field(graph: REVIEWS, requires: \"similarBooks{isbn}\")\n}\n\nunion Brand = Ikea | Amazon\n\ntype Car implements Vehicle\n@join__owner(graph: PRODUCT)\n@join__type(graph: PRODUCT, key: \"id\")\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: String! @join__field(graph: PRODUCT)\n  description: String @join__field(graph: PRODUCT)\n  price: String @join__field(graph: PRODUCT)\n  retailPrice: String @join__field(graph: REVIEWS, requires: \"price\")\n}\n\ntype Error {\n  code: Int\n  message: String\n}\n\ntype Furniture implements Product\n@join__owner(graph: PRODUCT)\n@join__type(graph: PRODUCT, key: \"upc\")\n@join__type(graph: PRODUCT, key: \"sku\")\n@join__type(graph: INVENTORY, key: \"sku\")\n@join__type(graph: REVIEWS, key: \"upc\")\n{\n  upc: String! @join__field(graph: PRODUCT)\n  sku: String! @join__field(graph: PRODUCT)\n  name: String @join__field(graph: PRODUCT)\n  price: String @join__field(graph: PRODUCT)\n  brand: Brand @join__field(graph: PRODUCT)\n  metadata: [MetadataOrError] @join__field(graph: PRODUCT)\n  details: ProductDetailsFurniture @join__field(graph: PRODUCT)\n  inStock: Boolean @join__field(graph: INVENTORY)\n  isHeavy: Boolean @join__field(graph: INVENTORY)\n  reviews: [Review] @join__field(graph: REVIEWS)\n}\n\ntype Ikea {\n  asile: Int\n}\n\ntype Image implements NamedObject {\n  name: String!\n  attributes: ImageAttributes!\n}\n\ntype ImageAttributes {\n  url: String!\n}\n\nscalar join__FieldSet @specifiedBy(url: \"https://spec.graphql.org/\")\n\nenum join__Graph {\nACCOUNTS @join__graph(name: \"accounts\" url: \"\")\nBOOKS @join__graph(name: \"books\" url: \"\")\nDOCUMENTS @join__graph(name: \"documents\" url: \"\")\nINVENTORY @join__graph(name: \"inventory\" url: \"\")\nPRODUCT @join__graph(name: \"product\" url: \"\")\nREVIEWS @join__graph(name: \"reviews\" url: \"\")\n}\n\ntype KeyValue {\n  key: String!\n  value: String!\n}\n\ntype Library\n@join__owner(graph: BOOKS)\n@join__type(graph: BOOKS, key: \"id\")\n@join__type(graph: ACCOUNTS, key: \"id\")\n{\n  id: ID! @join__field(graph: BOOKS)\n  name: String @join__field(graph: BOOKS)\n  userAccount(id: ID! = 1): User @join__field(graph: ACCOUNTS, requires: \"name\")\n}\n\nunion MetadataOrError = KeyValue | Error\n\ntype Mutation {\n  login(username: String!, password: String!): User @join__field(graph: ACCOUNTS)\n  reviewProduct(upc: String!, body: String!): Product @join__field(graph: REVIEWS)\n  updateReview(review: UpdateReviewInput!): Review @join__field(graph: REVIEWS)\n  deleteReview(id: ID!): Boolean @join__field(graph: REVIEWS)\n}\n\ntype Name {\n  first: String\n  last: String\n}\n\ninterface NamedObject {\n  name: String!\n}\n\ntype PasswordAccount\n@join__owner(graph: ACCOUNTS)\n@join__type(graph: ACCOUNTS, key: \"email\")\n{\n  email: String! @join__field(graph: ACCOUNTS)\n}\n\ninterface Product {\n  upc: String!\n  sku: String!\n  name: String\n  price: String\n  details: ProductDetails\n  inStock: Boolean\n  reviews: [Review]\n}\n\ninterface ProductDetails {\n  country: String\n}\n\ntype ProductDetailsBook implements ProductDetails {\n  country: String\n  pages: Int\n}\n\ntype ProductDetailsFurniture implements ProductDetails {\n  country: String\n  color: String\n}\n\ntype Query {\n  user(id: ID!): User @join__field(graph: ACCOUNTS)\n  me: User @join__field(graph: ACCOUNTS)\n  book(isbn: String!): Book @join__field(graph: BOOKS)\n  books: [Book] @join__field(graph: BOOKS)\n  library(id: ID!): Library @join__field(graph: BOOKS)\n  body: Body! @join__field(graph: DOCUMENTS)\n  product(upc: String!): Product @join__field(graph: PRODUCT)\n  vehicle(id: String!): Vehicle @join__field(graph: PRODUCT)\n  topProducts(first: Int = 5): [Product] @join__field(graph: PRODUCT)\n  topCars(first: Int = 5): [Car] @join__field(graph: PRODUCT)\n  topReviews(first: Int = 5): [Review] @join__field(graph: REVIEWS)\n}\n\ntype Review\n@join__owner(graph: REVIEWS)\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: ID! @join__field(graph: REVIEWS)\n  body(format: Boolean = false): String @join__field(graph: REVIEWS)\n  author: User @join__field(graph: REVIEWS, provides: \"username\")\n  product: Product @join__field(graph: REVIEWS)\n  metadata: [MetadataOrError] @join__field(graph: REVIEWS)\n}\n\ntype SMSAccount\n@join__owner(graph: ACCOUNTS)\n@join__type(graph: ACCOUNTS, key: \"number\")\n{\n  number: String @join__field(graph: ACCOUNTS)\n}\n\ntype Text implements NamedObject {\n  name: String!\n  attributes: TextAttributes!\n}\n\ntype TextAttributes {\n  bold: Boolean\n  text: String\n}\n\nunion Thing = Car | Ikea\n\ninput UpdateReviewInput {\n  id: ID!\n  body: String\n}\n\ntype User\n@join__owner(graph: ACCOUNTS)\n@join__type(graph: ACCOUNTS, key: \"id\")\n@join__type(graph: ACCOUNTS, key: \"username name{first last}\")\n@join__type(graph: INVENTORY, key: \"id\")\n@join__type(graph: PRODUCT, key: \"id\")\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: ID! @join__field(graph: ACCOUNTS)\n  name: Name @join__field(graph: ACCOUNTS)\n  username: String @join__field(graph: ACCOUNTS)\n  birthDate(locale: String): String @join__field(graph: ACCOUNTS)\n  account: AccountType @join__field(graph: ACCOUNTS)\n  metadata: [UserMetadata] @join__field(graph: ACCOUNTS)\n  goodDescription: Boolean @join__field(graph: INVENTORY, requires: \"metadata{description}\")\n  vehicle: Vehicle @join__field(graph: PRODUCT)\n  thing: Thing @join__field(graph: PRODUCT)\n  reviews: [Review] @join__field(graph: REVIEWS)\n  numberOfReviews: Int! @join__field(graph: REVIEWS)\n  goodAddress: Boolean @join__field(graph: REVIEWS, requires: \"metadata{address}\")\n}\n\ntype UserMetadata {\n  name: String\n  address: String\n  description: String\n}\n\ntype Van implements Vehicle\n@join__owner(graph: PRODUCT)\n@join__type(graph: PRODUCT, key: \"id\")\n@join__type(graph: REVIEWS, key: \"id\")\n{\n  id: String! @join__field(graph: PRODUCT)\n  description: String @join__field(graph: PRODUCT)\n  price: String @join__field(graph: PRODUCT)\n  retailPrice: String @join__field(graph: REVIEWS, requires: \"price\")\n}\n\ninterface Vehicle {\n  id: String!\n  description: String\n  price: String\n  retailPrice: String\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt b/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt
index 9dde188..0af25f2 100644
--- a/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt
+++ b/crates/apollo-compiler/test_data/ok/0016_same_variables_in_multiple_operations.txt
@@ -135,16 +135,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            16,
-            SourceFile {
-                path: "0016_same_variables_in_multiple_operations.graphql",
-                source_text: "query A($atOtherHomes: Boolean) {\n  ...HouseTrainedFragment\n}\n\nquery B($atOtherHomes: Boolean) {\n  ...HouseTrainedFragment\n}\n\nfragment HouseTrainedFragment on Query {\n  dog {\n    isHouseTrained(atOtherHomes: $atOtherHomes)\n  }\n}\n\ntype Query {\n  dog: Dog\n}\n\ntype Dog {\n  name: String!\n  nickname: String\n  barkVolume: Int\n  isHouseTrained(atOtherHomes: Boolean): Boolean!\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        16: SourceFile {
+            path: "0016_same_variables_in_multiple_operations.graphql",
+            source_text: "query A($atOtherHomes: Boolean) {\n  ...HouseTrainedFragment\n}\n\nquery B($atOtherHomes: Boolean) {\n  ...HouseTrainedFragment\n}\n\nfragment HouseTrainedFragment on Query {\n  dog {\n    isHouseTrained(atOtherHomes: $atOtherHomes)\n  }\n}\n\ntype Query {\n  dog: Dog\n}\n\ntype Dog {\n  name: String!\n  nickname: String\n  barkVolume: Int\n  isHouseTrained(atOtherHomes: Boolean): Boolean!\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt b/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt
index 9f46a58..931f159 100644
--- a/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt
+++ b/crates/apollo-compiler/test_data/ok/0017_variables_are_input_types.txt
@@ -213,16 +213,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            17,
-            SourceFile {
-                path: "0017_variables_are_input_types.graphql",
-                source_text: "query takesBoolean($atOtherHomes: Boolean) {\n  dog {\n    isHouseTrained(atOtherHomes: $atOtherHomes)\n  }\n}\n\nquery takesComplexInput($complexInput: ComplexInput) {\n  findDog(complex: $complexInput) {\n    name\n  }\n}\n\nquery TakesListOfBooleanBang($booleans: [Boolean!]) {\n  booleanList(booleanListArg: $booleans)\n}\n\n\ntype Dog {\n  name: String!\n  nickname: String\n  barkVolume: Int\n  isHouseTrained(atOtherHomes: Boolean): Boolean!\n}\n\ninput ComplexInput {\n  name: String\n  owner: String\n}\n\ntype Query {\n  dog: Dog\n  findDog(complex: ComplexInput): Dog\n  booleanList(booleanListArg: [Boolean!]): Boolean\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        17: SourceFile {
+            path: "0017_variables_are_input_types.graphql",
+            source_text: "query takesBoolean($atOtherHomes: Boolean) {\n  dog {\n    isHouseTrained(atOtherHomes: $atOtherHomes)\n  }\n}\n\nquery takesComplexInput($complexInput: ComplexInput) {\n  findDog(complex: $complexInput) {\n    name\n  }\n}\n\nquery TakesListOfBooleanBang($booleans: [Boolean!]) {\n  booleanList(booleanListArg: $booleans)\n}\n\n\ntype Dog {\n  name: String!\n  nickname: String\n  barkVolume: Int\n  isHouseTrained(atOtherHomes: Boolean): Boolean!\n}\n\ninput ComplexInput {\n  name: String\n  owner: String\n}\n\ntype Query {\n  dog: Dog\n  findDog(complex: ComplexInput): Dog\n  booleanList(booleanListArg: [Boolean!]): Boolean\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt b/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt
index 775d1b5..71f547b 100644
--- a/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt
+++ b/crates/apollo-compiler/test_data/ok/0018_non_clashing_names.txt
@@ -106,16 +106,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            18,
-            SourceFile {
-                path: "0018_non_clashing_names.graphql",
-                source_text: "# Types, directives, fragments, and operations each have their own namespace.\ntype A @A {\n  a: Int\n}\ntype Query {\n  a: A\n}\n\ndirective @A on OBJECT\n\nfragment A on A {\n  a\n}\n\nquery A {\n  a {\n    ...A\n  }\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        18: SourceFile {
+            path: "0018_non_clashing_names.graphql",
+            source_text: "# Types, directives, fragments, and operations each have their own namespace.\ntype A @A {\n  a: Int\n}\ntype Query {\n  a: A\n}\n\ndirective @A on OBJECT\n\nfragment A on A {\n  a\n}\n\nquery A {\n  a {\n    ...A\n  }\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0019_extensions.txt b/crates/apollo-compiler/test_data/ok/0019_extensions.txt
index 2ccc830..384c408 100644
--- a/crates/apollo-compiler/test_data/ok/0019_extensions.txt
+++ b/crates/apollo-compiler/test_data/ok/0019_extensions.txt
@@ -246,16 +246,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            19,
-            SourceFile {
-                path: "0019_extensions.graphql",
-                source_text: "scalar Scalar\n\ntype Object implements Intf {\n  field: Int,\n}\n\ninterface Intf {\n  field: Int,\n}\n\ninput Input {\n  field: Enum,\n}\nenum Enum {\n  MEMBER,\n}\n\nextend scalar Scalar @specifiedBy(url: \"https://apollographql.com\")\nextend interface Intf {\n  field2: Scalar,\n}\nextend type Object {\n  field2: Scalar,\n}\nextend enum Enum {\n  MEMBER_2,\n}\nextend input Input {\n  field2: Int,\n}\n\ntype Query {\n  object: Object,\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        19: SourceFile {
+            path: "0019_extensions.graphql",
+            source_text: "scalar Scalar\n\ntype Object implements Intf {\n  field: Int,\n}\n\ninterface Intf {\n  field: Int,\n}\n\ninput Input {\n  field: Enum,\n}\nenum Enum {\n  MEMBER,\n}\n\nextend scalar Scalar @specifiedBy(url: \"https://apollographql.com\")\nextend interface Intf {\n  field2: Scalar,\n}\nextend type Object {\n  field2: Scalar,\n}\nextend enum Enum {\n  MEMBER_2,\n}\nextend input Input {\n  field2: Int,\n}\n\ntype Query {\n  object: Object,\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt b/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt
index 2dd6f10..9bf4dbb 100644
--- a/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt
+++ b/crates/apollo-compiler/test_data/ok/0020_merge_identical_fields.txt
@@ -101,16 +101,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            20,
-            SourceFile {
-                path: "0020_merge_identical_fields.graphql",
-                source_text: "type Query {\n  pet: Dog\n}\n\ntype Dog {\n  nickname: String\n  name: String!\n}\n\nquery queryPupper {\n  pet {\n    ...mergeIdenticalFields\n    ...mergeIdenticalAliasesAndFields\n  }\n}\n\nfragment mergeIdenticalFields on Dog {\n  name\n  name\n}\n\nfragment mergeIdenticalAliasesAndFields on Dog {\n  otherName: name\n  otherName: name\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        20: SourceFile {
+            path: "0020_merge_identical_fields.graphql",
+            source_text: "type Query {\n  pet: Dog\n}\n\ntype Dog {\n  nickname: String\n  name: String!\n}\n\nquery queryPupper {\n  pet {\n    ...mergeIdenticalFields\n    ...mergeIdenticalAliasesAndFields\n  }\n}\n\nfragment mergeIdenticalFields on Dog {\n  name\n  name\n}\n\nfragment mergeIdenticalAliasesAndFields on Dog {\n  otherName: name\n  otherName: name\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt b/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt
index d6db352..9253a8a 100644
--- a/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt
+++ b/crates/apollo-compiler/test_data/ok/0021_merge_identical_fields_with_arguments.txt
@@ -123,16 +123,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            21,
-            SourceFile {
-                path: "0021_merge_identical_fields_with_arguments.graphql",
-                source_text: "enum DogCommand {\n  SIT\n  HEEL\n}\n\ntype Dog {\n  doesKnowCommand(dogCommand: DogCommand): Boolean\n}\n\ntype Query {\n  pet: Dog\n}\n\nquery queryPupper {\n  pet {\n    ...mergeIdenticalFieldsWithIdenticalArgs\n  }\n}\n\nquery queryPupperAgain($dogCommand: DogCommand) {\n  pet {\n    ...mergeIdenticalFieldsWithIdenticalValues\n  }\n}\n\nfragment mergeIdenticalFieldsWithIdenticalArgs on Dog {\n  doesKnowCommand(dogCommand: SIT)\n  doesKnowCommand(dogCommand: SIT)\n}\n\nfragment mergeIdenticalFieldsWithIdenticalValues on Dog {\n  doesKnowCommand(dogCommand: $dogCommand)\n  doesKnowCommand(dogCommand: $dogCommand)\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        21: SourceFile {
+            path: "0021_merge_identical_fields_with_arguments.graphql",
+            source_text: "enum DogCommand {\n  SIT\n  HEEL\n}\n\ntype Dog {\n  doesKnowCommand(dogCommand: DogCommand): Boolean\n}\n\ntype Query {\n  pet: Dog\n}\n\nquery queryPupper {\n  pet {\n    ...mergeIdenticalFieldsWithIdenticalArgs\n  }\n}\n\nquery queryPupperAgain($dogCommand: DogCommand) {\n  pet {\n    ...mergeIdenticalFieldsWithIdenticalValues\n  }\n}\n\nfragment mergeIdenticalFieldsWithIdenticalArgs on Dog {\n  doesKnowCommand(dogCommand: SIT)\n  doesKnowCommand(dogCommand: SIT)\n}\n\nfragment mergeIdenticalFieldsWithIdenticalValues on Dog {\n  doesKnowCommand(dogCommand: $dogCommand)\n  doesKnowCommand(dogCommand: $dogCommand)\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt b/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt
index dca3ce8..1dd6762 100644
--- a/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt
+++ b/crates/apollo-compiler/test_data/ok/0022_merge_differing_fields_and_args.txt
@@ -292,16 +292,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            22,
-            SourceFile {
-                path: "0022_merge_differing_fields_and_args.graphql",
-                source_text: "interface Pet {\n  name: String!\n}\n\nenum DogCommand {\n  SIT\n  HEEL\n}\n\nenum CatCommand {\n  JUMP\n}\n\ntype Query {\n  pet: Pet\n}\n\ntype Dog implements Pet {\n  name: String!\n  nickname: String!\n  barkVolume: Int!\n  doesKnowCommand(dogCommand: DogCommand!): Boolean!\n  isAtLocation(x: Int, y: Int): Boolean!\n}\n\ntype Cat implements Pet {\n  name: String!\n  meowVolume: Int!\n  doesKnowCommand(catCommand: CatCommand!): Boolean!\n}\n\nquery barkVolume {\n  pet {\n    ...safeDifferingFields\n  }\n}\n\nquery doesKnowCommand {\n  pet {\n    ...safeDifferingArgs\n  }\n}\n\nquery isAtLocation {\n  pet {\n    ...safeDifferingArgOrder\n  }\n}\n\nfragment safeDifferingFields on Pet {\n  ... on Dog {\n    volume: barkVolume\n  }\n  ... on Cat {\n    volume: meowVolume\n  }\n}\n\nfragment safeDifferingArgs on Pet {\n  ... on Dog {\n    doesKnowCommand(dogCommand: SIT)\n  }\n  ... on Cat {\n    doesKnowCommand(catCommand: JUMP)\n  }\n}\n\nfragment safeDifferingArgOrder on Dog {\n  isAtLocation(x: 0, y: 0)\n  isAtLocation(y: 0, x: 0)\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        22: SourceFile {
+            path: "0022_merge_differing_fields_and_args.graphql",
+            source_text: "interface Pet {\n  name: String!\n}\n\nenum DogCommand {\n  SIT\n  HEEL\n}\n\nenum CatCommand {\n  JUMP\n}\n\ntype Query {\n  pet: Pet\n}\n\ntype Dog implements Pet {\n  name: String!\n  nickname: String!\n  barkVolume: Int!\n  doesKnowCommand(dogCommand: DogCommand!): Boolean!\n  isAtLocation(x: Int, y: Int): Boolean!\n}\n\ntype Cat implements Pet {\n  name: String!\n  meowVolume: Int!\n  doesKnowCommand(catCommand: CatCommand!): Boolean!\n}\n\nquery barkVolume {\n  pet {\n    ...safeDifferingFields\n  }\n}\n\nquery doesKnowCommand {\n  pet {\n    ...safeDifferingArgs\n  }\n}\n\nquery isAtLocation {\n  pet {\n    ...safeDifferingArgOrder\n  }\n}\n\nfragment safeDifferingFields on Pet {\n  ... on Dog {\n    volume: barkVolume\n  }\n  ... on Cat {\n    volume: meowVolume\n  }\n}\n\nfragment safeDifferingArgs on Pet {\n  ... on Dog {\n    doesKnowCommand(dogCommand: SIT)\n  }\n  ... on Cat {\n    doesKnowCommand(catCommand: JUMP)\n  }\n}\n\nfragment safeDifferingArgOrder on Dog {\n  isAtLocation(x: 0, y: 0)\n  isAtLocation(y: 0, x: 0)\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt b/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt
index 0bddd97..1ea99d8 100644
--- a/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt
+++ b/crates/apollo-compiler/test_data/ok/0024_used_variables_in_directives.txt
@@ -102,16 +102,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            23,
-            SourceFile {
-                path: "0024_used_variables_in_directives.graphql",
-                source_text: "type Query {\n  field(arg: Boolean): Int\n  fragField: Int\n  inlineField: Int\n}\n\nfragment fragment on Query {\n  fragField @include(if: $indirectDirective)\n}\n\nquery (\n  $fieldDirective: Boolean = true,\n  $fragDirective: Boolean = false,\n  $inlineDirective: Boolean = false,\n  $argDirective: Boolean = false,\n  $indirectDirective: Boolean = false,\n) {\n  field(arg: $argDirective) @skip(if: $fieldDirective)\n\n  ...fragment @include(if: $fragDirective)\n\n  ... @skip(if: $inlineDirective) {\n    inlineField\n  }\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        23: SourceFile {
+            path: "0024_used_variables_in_directives.graphql",
+            source_text: "type Query {\n  field(arg: Boolean): Int\n  fragField: Int\n  inlineField: Int\n}\n\nfragment fragment on Query {\n  fragField @include(if: $indirectDirective)\n}\n\nquery (\n  $fieldDirective: Boolean = true,\n  $fragDirective: Boolean = false,\n  $inlineDirective: Boolean = false,\n  $argDirective: Boolean = false,\n  $indirectDirective: Boolean = false,\n) {\n  field(arg: $argDirective) @skip(if: $fieldDirective)\n\n  ...fragment @include(if: $fragDirective)\n\n  ... @skip(if: $inlineDirective) {\n    inlineField\n  }\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         156..505 @23 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt b/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt
index 9908a3a..9bbb419 100644
--- a/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt
+++ b/crates/apollo-compiler/test_data/ok/0025_unique_directives.txt
@@ -86,16 +86,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            24,
-            SourceFile {
-                path: "0025_unique_directives.graphql",
-                source_text: "directive @repeatable repeatable on FIELD\ndirective @unique on FIELD\n\ntype Query {\n  field: Int\n}\n\n{\n  field @repeatable @repeatable\n  field @unique\n  field @unique\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        24: SourceFile {
+            path: "0025_unique_directives.graphql",
+            source_text: "directive @repeatable repeatable on FIELD\ndirective @unique on FIELD\n\ntype Query {\n  field: Int\n}\n\n{\n  field @repeatable @repeatable\n  field @unique\n  field @unique\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         99..166 @24 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt b/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt
index ffdb987..f9810e1 100644
--- a/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt
+++ b/crates/apollo-compiler/test_data/ok/0026_type_introspection.txt
@@ -113,16 +113,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            25,
-            SourceFile {
-                path: "0026_type_introspection.graphql",
-                source_text: "type Query {\n  id: String\n  name: String\n  birthday: Date\n}\n\nscalar Date @specifiedBy(url: \"datespec.com\")\n\n{\n  __type(name: \"User\") {\n    name\n    fields {\n      name\n      type {\n        name\n      }\n    }\n  }\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        25: SourceFile {
+            path: "0026_type_introspection.graphql",
+            source_text: "type Query {\n  id: String\n  name: String\n  birthday: Date\n}\n\nscalar Date @specifiedBy(url: \"datespec.com\")\n\n{\n  __type(name: \"User\") {\n    name\n    fields {\n      name\n      type {\n        name\n      }\n    }\n  }\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         108..213 @25 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt b/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt
index 8722479..afd87ac 100644
--- a/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt
+++ b/crates/apollo-compiler/test_data/ok/0027_typename_introspection_in_object.txt
@@ -113,16 +113,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            26,
-            SourceFile {
-                path: "0027_typename_introspection_in_object.graphql",
-                source_text: "type Query {\n  id: String\n  name: String\n  birthday: Date\n}\n\nscalar Date @specifiedBy(url: \"datespec.com\")\n\n{\n    name\n    __typename\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        26: SourceFile {
+            path: "0027_typename_introspection_in_object.graphql",
+            source_text: "type Query {\n  id: String\n  name: String\n  birthday: Date\n}\n\nscalar Date @specifiedBy(url: \"datespec.com\")\n\n{\n    name\n    __typename\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         108..135 @26 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt b/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt
index 9a266fa..ef40f7e 100644
--- a/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt
+++ b/crates/apollo-compiler/test_data/ok/0028_typename_introspection_in_union.txt
@@ -150,16 +150,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            27,
-            SourceFile {
-                path: "0028_typename_introspection_in_union.graphql",
-                source_text: "union SearchResult = Photo | Person\n\ntype Person {\n  name: String\n  age: Int\n}\n\ntype Photo {\n  height: Int\n  width: Int\n}\n\ntype Query {\n  firstSearchResult: SearchResult\n}\n\n{\n  firstSearchResult {\n    __typename\n    ... on Person {\n      name\n    }\n    ... on Photo {\n      height\n    }\n  }\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        27: SourceFile {
+            path: "0028_typename_introspection_in_union.graphql",
+            source_text: "union SearchResult = Photo | Person\n\ntype Person {\n  name: String\n  age: Int\n}\n\ntype Photo {\n  height: Int\n  width: Int\n}\n\ntype Query {\n  firstSearchResult: SearchResult\n}\n\n{\n  firstSearchResult {\n    __typename\n    ... on Person {\n      name\n    }\n    ... on Photo {\n      height\n    }\n  }\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         173..292 @27 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt b/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt
index 62fe305..417dce3 100644
--- a/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt
+++ b/crates/apollo-compiler/test_data/ok/0029_used_variable_in_list_and_input.txt
@@ -139,16 +139,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            28,
-            SourceFile {
-                path: "0029_used_variable_in_list_and_input.graphql",
-                source_text: "type Product {\n  attributes(includeNames: [String!]): [String!]\n}\n\ninput Opts {\n  prop: [[Int]!]!\n}\n\ntype Query {\n  field(\n    opts: Opts\n  ): [Product]\n}\n\nquery ($attributeName: String!, $v: Int) {\n  field(opts: {\n    prop: [[2], [$v], [4]],\n  }) {\n    attributes(includeNames: [$attributeName])\n  }\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        28: SourceFile {
+            path: "0029_used_variable_in_list_and_input.graphql",
+            source_text: "type Product {\n  attributes(includeNames: [String!]): [String!]\n}\n\ninput Opts {\n  prop: [[Int]!]!\n}\n\ntype Query {\n  field(\n    opts: Opts\n  ): [Product]\n}\n\nquery ($attributeName: String!, $v: Int) {\n  field(opts: {\n    prop: [[2], [$v], [4]],\n  }) {\n    attributes(includeNames: [$attributeName])\n  }\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: Some(
         156..302 @28 Operation {
diff --git a/crates/apollo-compiler/test_data/ok/0030_cyclical_nullable_input_objects.txt b/crates/apollo-compiler/test_data/ok/0030_cyclical_nullable_input_objects.txt
index fe6a1f3..02d4409 100644
--- a/crates/apollo-compiler/test_data/ok/0030_cyclical_nullable_input_objects.txt
+++ b/crates/apollo-compiler/test_data/ok/0030_cyclical_nullable_input_objects.txt
@@ -208,16 +208,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            29,
-            SourceFile {
-                path: "0030_cyclical_nullable_input_objects.graphql",
-                source_text: "type Query {\n    name: String\n    example(arg: First): Int\n}\n\ninput First {\n  second: Second\n  value: String\n}\n\ninput Second {\n  third: [Third!]!\n  value: String\n}\n\ninput Third {\n  fourth: Fourth\n  value: String\n}\n\ninput Fourth {\n  first: First\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        29: SourceFile {
+            path: "0030_cyclical_nullable_input_objects.graphql",
+            source_text: "type Query {\n    name: String\n    example(arg: First): Int\n}\n\ninput First {\n  second: Second\n  value: String\n}\n\ninput Second {\n  third: [Third!]!\n  value: String\n}\n\ninput Third {\n  fourth: Fourth\n  value: String\n}\n\ninput Fourth {\n  first: First\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0031_fragment_spread_possible.txt b/crates/apollo-compiler/test_data/ok/0031_fragment_spread_possible.txt
index cd72c4f..dcde4c4 100644
--- a/crates/apollo-compiler/test_data/ok/0031_fragment_spread_possible.txt
+++ b/crates/apollo-compiler/test_data/ok/0031_fragment_spread_possible.txt
@@ -333,16 +333,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            30,
-            SourceFile {
-                path: "0031_fragment_spread_possible.graphql",
-                source_text: "interface Pet {\n  name: String!\n}\n\ntype Dog implements Pet {\n  name: String!\n  barkVolume: Int\n}\n\ntype Cat implements Pet {\n  name: String!\n  meowVolume: Int\n}\n\nunion CatOrDog = Cat | Dog\n\ntype Human {\n  pets: [Pet!]\n}\n\nunion DogOrHuman = Dog | Human\n\n# https://spec.graphql.org/October2021/#sec-Object-Spreads-In-Object-Scope\nfragment dogFragment on Dog {\n  ... on Dog {\n    barkVolume\n  }\n}\n\n# https://spec.graphql.org/October2021/#sec-Abstract-Spreads-in-Object-Scope\nfragment petNameFragment on Pet {\n  name\n}\n\nfragment interfaceWithinObjectFragment on Dog {\n  ...petNameFragment\n}\n\nfragment catOrDogNameFragment on CatOrDog {\n  ... on Cat {\n    meowVolume\n  }\n}\n\nfragment unionWithObjectFragment on Dog {\n  ...catOrDogNameFragment\n}\n\n# https://spec.graphql.org/October2021/#sec-Object-Spreads-In-Abstract-Scope\nfragment petFragment on Pet {\n  name\n  ... on Dog {\n    barkVolume\n  }\n}\n\nfragment catOrDogFragment on CatOrDog {\n  ... on Cat {\n    meowVolume\n  }\n}\n\n# https://spec.graphql.org/October2021/#sec-Abstract-Spreads-in-Abstract-Scope\nfragment unionWithInterface on Pet {\n  ...dogOrHumanFragment\n}\n\nfragment dogOrHumanFragment on DogOrHuman {\n  ... on Dog {\n    barkVolume\n  }\n}\n\n# https://spec.graphql.org/October2021/#sec-Abstract-Spreads-in-Abstract-Scope.Interface-Spreads-in-implemented-Interface-Scope\ninterface Node {\n  id: ID!\n}\n\ninterface Resource implements Node {\n  id: ID!\n  url: String\n}\n\n# The validation for fragment spreads works on concrete types.\ntype ConcreteResource implements Resource & Node {\n  id: ID!\n  url: String\n}\n\nfragment interfaceWithInterface on Node {\n  ...resourceFragment\n}\n\nfragment resourceFragment on Resource {\n  url\n}\n\n# Make sure the above fragments are used\ntype Query {\n  pet: Pet\n  resource: Resource\n}\n\nquery UseAllFragments {\n  pet {\n    ... dogFragment\n    ... interfaceWithinObjectFragment\n    ... unionWithObjectFragment\n    ... petFragment\n    ... catOrDogFragment\n    ... unionWithInterface\n  }\n  resource {\n    ...interfaceWithInterface\n    ... @skip(if: true) {\n      urlInInlineFragment: url\n    }\n  }\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        30: SourceFile {
+            path: "0031_fragment_spread_possible.graphql",
+            source_text: "interface Pet {\n  name: String!\n}\n\ntype Dog implements Pet {\n  name: String!\n  barkVolume: Int\n}\n\ntype Cat implements Pet {\n  name: String!\n  meowVolume: Int\n}\n\nunion CatOrDog = Cat | Dog\n\ntype Human {\n  pets: [Pet!]\n}\n\nunion DogOrHuman = Dog | Human\n\n# https://spec.graphql.org/October2021/#sec-Object-Spreads-In-Object-Scope\nfragment dogFragment on Dog {\n  ... on Dog {\n    barkVolume\n  }\n}\n\n# https://spec.graphql.org/October2021/#sec-Abstract-Spreads-in-Object-Scope\nfragment petNameFragment on Pet {\n  name\n}\n\nfragment interfaceWithinObjectFragment on Dog {\n  ...petNameFragment\n}\n\nfragment catOrDogNameFragment on CatOrDog {\n  ... on Cat {\n    meowVolume\n  }\n}\n\nfragment unionWithObjectFragment on Dog {\n  ...catOrDogNameFragment\n}\n\n# https://spec.graphql.org/October2021/#sec-Object-Spreads-In-Abstract-Scope\nfragment petFragment on Pet {\n  name\n  ... on Dog {\n    barkVolume\n  }\n}\n\nfragment catOrDogFragment on CatOrDog {\n  ... on Cat {\n    meowVolume\n  }\n}\n\n# https://spec.graphql.org/October2021/#sec-Abstract-Spreads-in-Abstract-Scope\nfragment unionWithInterface on Pet {\n  ...dogOrHumanFragment\n}\n\nfragment dogOrHumanFragment on DogOrHuman {\n  ... on Dog {\n    barkVolume\n  }\n}\n\n# https://spec.graphql.org/October2021/#sec-Abstract-Spreads-in-Abstract-Scope.Interface-Spreads-in-implemented-Interface-Scope\ninterface Node {\n  id: ID!\n}\n\ninterface Resource implements Node {\n  id: ID!\n  url: String\n}\n\n# The validation for fragment spreads works on concrete types.\ntype ConcreteResource implements Resource & Node {\n  id: ID!\n  url: String\n}\n\nfragment interfaceWithInterface on Node {\n  ...resourceFragment\n}\n\nfragment resourceFragment on Resource {\n  url\n}\n\n# Make sure the above fragments are used\ntype Query {\n  pet: Pet\n  resource: Resource\n}\n\nquery UseAllFragments {\n  pet {\n    ... dogFragment\n    ... interfaceWithinObjectFragment\n    ... unionWithObjectFragment\n    ... petFragment\n    ... catOrDogFragment\n    ... unionWithInterface\n  }\n  resource {\n    ...interfaceWithInterface\n    ... @skip(if: true) {\n      urlInInlineFragment: url\n    }\n  }\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0032_valid_of_correct_type.txt b/crates/apollo-compiler/test_data/ok/0032_valid_of_correct_type.txt
index 742d072..5ca8342 100644
--- a/crates/apollo-compiler/test_data/ok/0032_valid_of_correct_type.txt
+++ b/crates/apollo-compiler/test_data/ok/0032_valid_of_correct_type.txt
@@ -874,16 +874,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            31,
-            SourceFile {
-                path: "0032_valid_of_correct_type.graphql",
-                source_text: "type ComplicatedArgs {\n  # TODO List\n  # TODO Coercion\n  # TODO NotNulls\n  intArgField(intArg: Int): String\n  nonNullIntArgField(nonNullIntArg: Int!): String\n  stringArgField(stringArg: String): String\n  booleanArgField(booleanArg: Boolean): String\n  enumArgField(enumArg: FurColor): String\n  floatArgField(floatArg: Float): String\n  idArgField(idArg: ID): String\n  stringListArgField(stringListArg: [String]): String\n  stringListNonNullArgField(stringListNonNullArg: [String!]): String\n  customScalar(customScalar: Custom): String\n  complexArgField(complexArg: ComplexInput): String\n  multipleReqs(req1: Int!, req2: Int!): String\n  nonNullFieldWithDefault(arg: Int! = 0): String\n  multipleOpts(opt1: Int = 0, opt2: Int = 0): String\n  multipleOptAndReq(req1: Int!, req2: Int!, opt1: Int = 0, opt2: Int = 0): String\n}\n\nscalar Custom @specifiedBy(url: \"example.com\")\n\nenum FurColor {\n  BROWN\n  BLACK\n  TAN\n  SPOTTED\n  NO_FUR\n  UNKNOWN\n}\n\ninput ComplexInput {\n  requiredField: Boolean!\n  nonNullField: Boolean! = false\n  intField: Int\n  stringField: String\n  booleanField: Boolean\n  stringListField: [String]\n}\n\nenum DogCommand {\n  SIT\n  HEEL\n  DOWN\n}\n\ntype Dog {\n  doesKnowCommand(dogCommand: DogCommand): Boolean\n  name(surname: Boolean): String\n  isHouseTrained(atOtherHomes: Boolean = true): Boolean\n}\n\ninterface Pet {\n  name(surname: Boolean): String\n}\n\ntype Query {\n  complicatedArgs: ComplicatedArgs\n  dog: Dog\n  human(id: ID): Human\n}\n\ntype Human {\n  name(surname: Boolean): String\n  pets: [Pet]\n  relatives: [Human]!\n}\n\nquery goodIntValue {\n  complicatedArgs {\n    intArgField(intArg: 2)\n  }\n}\n\nquery goodNegativeIntValue{\n  complicatedArgs {\n    intArgField(intArg: -2)\n  }\n}\n\nquery goodBooleanValue {\n  complicatedArgs {\n    booleanArgField(booleanArg: true)\n  }\n}\n\nquery goodStringValue {\n  complicatedArgs {\n    stringArgField(stringArg: \"foo\")\n  }\n}\n\nquery goodFloatValue {\n  complicatedArgs {\n    floatArgField(floatArg: 1.1)\n  }\n}\n\nquery goodNegativeFloatValue {\n  complicatedArgs {\n    floatArgField(floatArg: -1.1)\n  }\n}\n\nquery intIntoFloat {\n  complicatedArgs {\n    floatArgField(floatArg: 1)\n  }\n}\n\nquery intIntoID {\n  complicatedArgs {\n    idArgField(idArg: 1)\n  }\n}\n\nquery stringIntoID {\n  complicatedArgs {\n    idArgField(idArg: \"someIdString\")\n  }\n}\n\nquery goodEnumValue {\n  dog {\n    doesKnowCommand(dogCommand: SIT)\n  }\n}\n\nquery enumWithUndefinedValue {\n  complicatedArgs {\n    enumArgField(enumArg: UNKNOWN)\n  }\n}\n\nquery enumWithNullValue {\n  complicatedArgs {\n    enumArgField(enumArg: null)\n  }\n}\n\nquery nullIntoNullableType {\n  complicatedArgs {\n    intArgField(intArg: null)\n  }\n}\n\nquery goodListValue {\n  complicatedArgs {\n    stringListArgField(stringListArg: [\"one\", null, \"two\"])\n  }\n}\n\nquery emptyListValue {\n  complicatedArgs {\n    stringListArgField(stringListArg: [])\n  }\n}\n\nquery nullListValue {\n  complicatedArgs {\n    stringListArgField(stringListArg: null)\n  }\n}\n\nquery singleValueIntoList {\n  complicatedArgs {\n    stringListArgField(stringListArg: \"one\")\n  }\n}\n\n# Valid Non-Nullable Value\nquery argOnOptionalArg {\n  dog {\n    isHouseTrained(atOtherHomes: true)\n  }\n}\n\nquery noArgOnOptionalArg {\n  dog {\n    isHouseTrained\n  }\n}\n\nquery multipleArgs {\n  complicatedArgs {\n    multipleReqs(req1: 1, req2: 2)\n  }\n}\n\nquery multiplArgsReverseOrder {\n  complicatedArgs {\n    multipleReqs(req2: 2, req1: 1)\n  }\n}\n\nquery noArgsOnMultipleOptional {\n  complicatedArgs {\n    multipleOpts\n  }\n}\n\nquery oneArgOnMultipleOptional {\n  complicatedArgs {\n    multipleOpts(opt1: 1)\n  }\n}\n\nquery secondArgOnMultipleOptional {\n  complicatedArgs {\n    multipleOpts(opt2: 1)\n  }\n}\n\nquery multipleRequiredArgsOnMixedList {\n  complicatedArgs {\n    multipleOptAndReq(req1: 3, req2: 4)\n  }\n}\n\nquery multipleRequiredAndOneOptionalArgOnMixedList {\n  complicatedArgs {\n    multipleOptAndReq(req1: 3, req2: 4, opt1: 5)\n  }\n}\n\nquery AllRequiredAndOptionalArgsOnMixedList {\n  complicatedArgs {\n    multipleOptAndReq(req1: 3, req2: 4, opt1: 5, opt2: 6)\n  }\n}\n\n# Valid input object value\nquery optionalArgDespiteRequiredFieldInType {\n  complicatedArgs {\n    complexArgField\n  }\n}\n\nquery partialObjectOnlyRequired {\n  complicatedArgs {\n    complexArgField(complexArg: { requiredField: true })\n  }\n}\n\nquery partialObjectRequiredFieldCanBeFalse {\n  complicatedArgs {\n    complexArgField(complexArg: { requiredField: false })\n  }\n}\n\nquery partialObjectIncludingRequired {\n  complicatedArgs {\n    complexArgField(complexArg: { requiredField: true, intField: 4 })\n  }\n}\n\nquery fullObject {\n  complicatedArgs {\n    complexArgField(complexArg: {\n      requiredField: true,\n      intField: 4,\n      stringField: \"foo\",\n      booleanField: false,\n      stringListField: [\"one\", \"two\"]\n    })\n  }\n}\n\nquery fullObjectWithFieldsInDifferentOrder {\n  complicatedArgs {\n    complexArgField(complexArg: {\n      stringListField: [\"one\", \"two\"],\n      booleanField: false,\n      requiredField: true,\n      stringField: \"foo\",\n      intField: 4,\n    })\n  }\n}\n\nquery withDirectivesOfValidTypes {\n  dog @include(if: true) {\n    name\n  }\n  human @skip(if: false) {\n    name\n  }\n}\n\n\n# Variable default values\nquery withDefaultValues(\n  $a: Int = 1,\n  $b: String = \"ok\",\n  $c: ComplexInput = { requiredField: true, intField: 3 }\n) {\n  complicatedArgs {\n    complexArgField(complexArg: $c)\n    intArgField(intArg: $a)\n    stringArgField(stringArg: $b)\n  }\n}\n\nquery variablesWithDefaultNullValues(\n  $a: Int = null,\n  $b: String = null,\n  $c: ComplexInput = { requiredField: true, intField: null }\n) {\n  complicatedArgs {\n    complexArgField(complexArg: $c)\n    intArgField(intArg: $a)\n    stringArgField(stringArg: $b)\n  }\n\n}\n\n# Custom Scalars\nquery customScalarWithStringValue {\n  complicatedArgs {\n    customScalar(customScalar: \"custom\")\n  }\n}\n\nquery customScalarWithIntValue {\n  complicatedArgs {\n    customScalar(customScalar: 4)\n  }\n}\n\nquery customScalarWithBooleanValue {\n  complicatedArgs {\n    customScalar(customScalar: true)\n  }\n}\n\nquery customScalarWithFloatValue {\n  complicatedArgs {\n    customScalar(customScalar: 4.4)\n  }\n}\n\nquery customScalarWithVariableValue($custom: Custom = 4) {\n  complicatedArgs {\n    customScalar(customScalar: $custom)\n  }\n\n}\n\nquery customScalarWithArbitraryInputObject {\n  complicatedArgs {\n    customScalar(customScalar: { as: \"@key\" })\n  }\n}\n\nquery customScalarWithListValue {\n  complicatedArgs {\n    customScalar(customScalar: [0, 1, 2])\n  }\n}\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        31: SourceFile {
+            path: "0032_valid_of_correct_type.graphql",
+            source_text: "type ComplicatedArgs {\n  # TODO List\n  # TODO Coercion\n  # TODO NotNulls\n  intArgField(intArg: Int): String\n  nonNullIntArgField(nonNullIntArg: Int!): String\n  stringArgField(stringArg: String): String\n  booleanArgField(booleanArg: Boolean): String\n  enumArgField(enumArg: FurColor): String\n  floatArgField(floatArg: Float): String\n  idArgField(idArg: ID): String\n  stringListArgField(stringListArg: [String]): String\n  stringListNonNullArgField(stringListNonNullArg: [String!]): String\n  customScalar(customScalar: Custom): String\n  complexArgField(complexArg: ComplexInput): String\n  multipleReqs(req1: Int!, req2: Int!): String\n  nonNullFieldWithDefault(arg: Int! = 0): String\n  multipleOpts(opt1: Int = 0, opt2: Int = 0): String\n  multipleOptAndReq(req1: Int!, req2: Int!, opt1: Int = 0, opt2: Int = 0): String\n}\n\nscalar Custom @specifiedBy(url: \"example.com\")\n\nenum FurColor {\n  BROWN\n  BLACK\n  TAN\n  SPOTTED\n  NO_FUR\n  UNKNOWN\n}\n\ninput ComplexInput {\n  requiredField: Boolean!\n  nonNullField: Boolean! = false\n  intField: Int\n  stringField: String\n  booleanField: Boolean\n  stringListField: [String]\n}\n\nenum DogCommand {\n  SIT\n  HEEL\n  DOWN\n}\n\ntype Dog {\n  doesKnowCommand(dogCommand: DogCommand): Boolean\n  name(surname: Boolean): String\n  isHouseTrained(atOtherHomes: Boolean = true): Boolean\n}\n\ninterface Pet {\n  name(surname: Boolean): String\n}\n\ntype Query {\n  complicatedArgs: ComplicatedArgs\n  dog: Dog\n  human(id: ID): Human\n}\n\ntype Human {\n  name(surname: Boolean): String\n  pets: [Pet]\n  relatives: [Human]!\n}\n\nquery goodIntValue {\n  complicatedArgs {\n    intArgField(intArg: 2)\n  }\n}\n\nquery goodNegativeIntValue{\n  complicatedArgs {\n    intArgField(intArg: -2)\n  }\n}\n\nquery goodBooleanValue {\n  complicatedArgs {\n    booleanArgField(booleanArg: true)\n  }\n}\n\nquery goodStringValue {\n  complicatedArgs {\n    stringArgField(stringArg: \"foo\")\n  }\n}\n\nquery goodFloatValue {\n  complicatedArgs {\n    floatArgField(floatArg: 1.1)\n  }\n}\n\nquery goodNegativeFloatValue {\n  complicatedArgs {\n    floatArgField(floatArg: -1.1)\n  }\n}\n\nquery intIntoFloat {\n  complicatedArgs {\n    floatArgField(floatArg: 1)\n  }\n}\n\nquery intIntoID {\n  complicatedArgs {\n    idArgField(idArg: 1)\n  }\n}\n\nquery stringIntoID {\n  complicatedArgs {\n    idArgField(idArg: \"someIdString\")\n  }\n}\n\nquery goodEnumValue {\n  dog {\n    doesKnowCommand(dogCommand: SIT)\n  }\n}\n\nquery enumWithUndefinedValue {\n  complicatedArgs {\n    enumArgField(enumArg: UNKNOWN)\n  }\n}\n\nquery enumWithNullValue {\n  complicatedArgs {\n    enumArgField(enumArg: null)\n  }\n}\n\nquery nullIntoNullableType {\n  complicatedArgs {\n    intArgField(intArg: null)\n  }\n}\n\nquery goodListValue {\n  complicatedArgs {\n    stringListArgField(stringListArg: [\"one\", null, \"two\"])\n  }\n}\n\nquery emptyListValue {\n  complicatedArgs {\n    stringListArgField(stringListArg: [])\n  }\n}\n\nquery nullListValue {\n  complicatedArgs {\n    stringListArgField(stringListArg: null)\n  }\n}\n\nquery singleValueIntoList {\n  complicatedArgs {\n    stringListArgField(stringListArg: \"one\")\n  }\n}\n\n# Valid Non-Nullable Value\nquery argOnOptionalArg {\n  dog {\n    isHouseTrained(atOtherHomes: true)\n  }\n}\n\nquery noArgOnOptionalArg {\n  dog {\n    isHouseTrained\n  }\n}\n\nquery multipleArgs {\n  complicatedArgs {\n    multipleReqs(req1: 1, req2: 2)\n  }\n}\n\nquery multiplArgsReverseOrder {\n  complicatedArgs {\n    multipleReqs(req2: 2, req1: 1)\n  }\n}\n\nquery noArgsOnMultipleOptional {\n  complicatedArgs {\n    multipleOpts\n  }\n}\n\nquery oneArgOnMultipleOptional {\n  complicatedArgs {\n    multipleOpts(opt1: 1)\n  }\n}\n\nquery secondArgOnMultipleOptional {\n  complicatedArgs {\n    multipleOpts(opt2: 1)\n  }\n}\n\nquery multipleRequiredArgsOnMixedList {\n  complicatedArgs {\n    multipleOptAndReq(req1: 3, req2: 4)\n  }\n}\n\nquery multipleRequiredAndOneOptionalArgOnMixedList {\n  complicatedArgs {\n    multipleOptAndReq(req1: 3, req2: 4, opt1: 5)\n  }\n}\n\nquery AllRequiredAndOptionalArgsOnMixedList {\n  complicatedArgs {\n    multipleOptAndReq(req1: 3, req2: 4, opt1: 5, opt2: 6)\n  }\n}\n\n# Valid input object value\nquery optionalArgDespiteRequiredFieldInType {\n  complicatedArgs {\n    complexArgField\n  }\n}\n\nquery partialObjectOnlyRequired {\n  complicatedArgs {\n    complexArgField(complexArg: { requiredField: true })\n  }\n}\n\nquery partialObjectRequiredFieldCanBeFalse {\n  complicatedArgs {\n    complexArgField(complexArg: { requiredField: false })\n  }\n}\n\nquery partialObjectIncludingRequired {\n  complicatedArgs {\n    complexArgField(complexArg: { requiredField: true, intField: 4 })\n  }\n}\n\nquery fullObject {\n  complicatedArgs {\n    complexArgField(complexArg: {\n      requiredField: true,\n      intField: 4,\n      stringField: \"foo\",\n      booleanField: false,\n      stringListField: [\"one\", \"two\"]\n    })\n  }\n}\n\nquery fullObjectWithFieldsInDifferentOrder {\n  complicatedArgs {\n    complexArgField(complexArg: {\n      stringListField: [\"one\", \"two\"],\n      booleanField: false,\n      requiredField: true,\n      stringField: \"foo\",\n      intField: 4,\n    })\n  }\n}\n\nquery withDirectivesOfValidTypes {\n  dog @include(if: true) {\n    name\n  }\n  human @skip(if: false) {\n    name\n  }\n}\n\n\n# Variable default values\nquery withDefaultValues(\n  $a: Int = 1,\n  $b: String = \"ok\",\n  $c: ComplexInput = { requiredField: true, intField: 3 }\n) {\n  complicatedArgs {\n    complexArgField(complexArg: $c)\n    intArgField(intArg: $a)\n    stringArgField(stringArg: $b)\n  }\n}\n\nquery variablesWithDefaultNullValues(\n  $a: Int = null,\n  $b: String = null,\n  $c: ComplexInput = { requiredField: true, intField: null }\n) {\n  complicatedArgs {\n    complexArgField(complexArg: $c)\n    intArgField(intArg: $a)\n    stringArgField(stringArg: $b)\n  }\n\n}\n\n# Custom Scalars\nquery customScalarWithStringValue {\n  complicatedArgs {\n    customScalar(customScalar: \"custom\")\n  }\n}\n\nquery customScalarWithIntValue {\n  complicatedArgs {\n    customScalar(customScalar: 4)\n  }\n}\n\nquery customScalarWithBooleanValue {\n  complicatedArgs {\n    customScalar(customScalar: true)\n  }\n}\n\nquery customScalarWithFloatValue {\n  complicatedArgs {\n    customScalar(customScalar: 4.4)\n  }\n}\n\nquery customScalarWithVariableValue($custom: Custom = 4) {\n  complicatedArgs {\n    customScalar(customScalar: $custom)\n  }\n\n}\n\nquery customScalarWithArbitraryInputObject {\n  complicatedArgs {\n    customScalar(customScalar: { as: \"@key\" })\n  }\n}\n\nquery customScalarWithListValue {\n  complicatedArgs {\n    customScalar(customScalar: [0, 1, 2])\n  }\n}\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0033_valid_variable_usage.txt b/crates/apollo-compiler/test_data/ok/0033_valid_variable_usage.txt
index 61f18ff..9feb5ec 100644
--- a/crates/apollo-compiler/test_data/ok/0033_valid_variable_usage.txt
+++ b/crates/apollo-compiler/test_data/ok/0033_valid_variable_usage.txt
@@ -149,16 +149,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            32,
-            SourceFile {
-                path: "0033_valid_variable_usage.graphql",
-                source_text: "query nullableStringArg($nonNullableVar: String!, $nonNullableList: [String!]!, $nonNullableListList: [[Int!]!]) {\n  arguments {\n    nullableString(nullableString: $nonNullableVar)\n    nullableList(nullableList: $nonNullableList)\n    nullableListList(nullableListList: $nonNullableListList)\n  }\n}\n\ntype Query {\n    arguments: Arguments\n}\n\ntype Arguments {\n    nullableString(nullableString: String): String\n    nullableList(nullableList: [String]): String\n    nullableListList(nullableListList: [[Int]]): Int\n}\n\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        32: SourceFile {
+            path: "0033_valid_variable_usage.graphql",
+            source_text: "query nullableStringArg($nonNullableVar: String!, $nonNullableList: [String!]!, $nonNullableListList: [[Int!]!]) {\n  arguments {\n    nullableString(nullableString: $nonNullableVar)\n    nullableList(nullableList: $nonNullableList)\n    nullableListList(nullableListList: $nonNullableListList)\n  }\n}\n\ntype Query {\n    arguments: Arguments\n}\n\ntype Arguments {\n    nullableString(nullableString: String): String\n    nullableList(nullableList: [String]): String\n    nullableListList(nullableListList: [[Int]]): Int\n}\n\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {
diff --git a/crates/apollo-compiler/test_data/ok/0034_built_in_directive_redefinition.txt b/crates/apollo-compiler/test_data/ok/0034_built_in_directive_redefinition.txt
index 5eb1261..87537c1 100644
--- a/crates/apollo-compiler/test_data/ok/0034_built_in_directive_redefinition.txt
+++ b/crates/apollo-compiler/test_data/ok/0034_built_in_directive_redefinition.txt
@@ -109,16 +109,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            33,
-            SourceFile {
-                path: "0034_built_in_directive_redefinition.graphql",
-                source_text: "schema\n  @deprecated(\n    reason: \"\"\"\n    The person who got promoted by shipping this product has moved on to another team.\n    The service will shut down next month.\n    \"\"\"\n  ) {\n  query: Query\n}\n\ntype Query {\n  importantData: Int\n}\n\ndirective @deprecated(\n  reason: String = \"No longer supported\"\n) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE | SCHEMA\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        33: SourceFile {
+            path: "0034_built_in_directive_redefinition.graphql",
+            source_text: "schema\n  @deprecated(\n    reason: \"\"\"\n    The person who got promoted by shipping this product has moved on to another team.\n    The service will shut down next month.\n    \"\"\"\n  ) {\n  query: Query\n}\n\ntype Query {\n  importantData: Int\n}\n\ndirective @deprecated(\n  reason: String = \"No longer supported\"\n) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE | SCHEMA\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0035_implicit_schema_definition_with_query_type.txt b/crates/apollo-compiler/test_data/ok/0035_implicit_schema_definition_with_query_type.txt
index 1614e16..51e427f 100644
--- a/crates/apollo-compiler/test_data/ok/0035_implicit_schema_definition_with_query_type.txt
+++ b/crates/apollo-compiler/test_data/ok/0035_implicit_schema_definition_with_query_type.txt
@@ -68,16 +68,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            34,
-            SourceFile {
-                path: "0035_implicit_schema_definition_with_query_type.graphql",
-                source_text: "type Query {\n    name: String\n}",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        34: SourceFile {
+            path: "0035_implicit_schema_definition_with_query_type.graphql",
+            source_text: "type Query {\n    name: String\n}",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0036_implicit_schema_definition_with_several_default_types.txt b/crates/apollo-compiler/test_data/ok/0036_implicit_schema_definition_with_several_default_types.txt
index 1d05380..7499931 100644
--- a/crates/apollo-compiler/test_data/ok/0036_implicit_schema_definition_with_several_default_types.txt
+++ b/crates/apollo-compiler/test_data/ok/0036_implicit_schema_definition_with_several_default_types.txt
@@ -125,16 +125,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            35,
-            SourceFile {
-                path: "0036_implicit_schema_definition_with_several_default_types.graphql",
-                source_text: "type Query {\n    name: String\n}\n\ntype Mutation {\n   add(name: String!): Result!\n}\n\ntype Result {\n  id: String\n}\n\n",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        35: SourceFile {
+            path: "0036_implicit_schema_definition_with_several_default_types.graphql",
+            source_text: "type Query {\n    name: String\n}\n\ntype Mutation {\n   add(name: String!): Result!\n}\n\ntype Result {\n  id: String\n}\n\n",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},
diff --git a/crates/apollo-compiler/test_data/ok/0037_implicit_schema_extension_with_directive.txt b/crates/apollo-compiler/test_data/ok/0037_implicit_schema_extension_with_directive.txt
index 56ad083..b6b404f 100644
--- a/crates/apollo-compiler/test_data/ok/0037_implicit_schema_extension_with_directive.txt
+++ b/crates/apollo-compiler/test_data/ok/0037_implicit_schema_extension_with_directive.txt
@@ -91,16 +91,13 @@ Schema {
     },
 }
 ExecutableDocument {
-    source: Some(
-        (
-            36,
-            SourceFile {
-                path: "0037_implicit_schema_extension_with_directive.graphql",
-                source_text: "type Query {\n    name: String\n}\n\nextend schema @dir\ndirective @dir on SCHEMA",
-                parse_errors: [],
-            },
-        ),
-    ),
+    sources: {
+        36: SourceFile {
+            path: "0037_implicit_schema_extension_with_directive.graphql",
+            source_text: "type Query {\n    name: String\n}\n\nextend schema @dir\ndirective @dir on SCHEMA",
+            parse_errors: [],
+        },
+    },
     build_errors: [],
     anonymous_operation: None,
     named_operations: {},