apollo-compiler@1.0.0-beta.3
·
284 commits
to main
since this release
1.0.0-beta.3 - 2023-10-13
BREAKING
- Keep source files in
Arc<Map<…>>everywhere - SimonSapin, pull/696:
Change struct fields fromsources: IndexMap<FileId, Arc<SourceFile>>(inSchema) orsource: Option<(FileId, Arc<SourceFile>)>(inDocument,ExecutablDocument,FieldSet) tosources: SourceMap, with:Cases other thanpub type SourceMap = Arc<IndexMap<FileId, Arc<SourceFile>>>;
Schemastill 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: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:
let schema = Schema::parse(input, "schema.graphql"); if let Err(errors) = schema.validate() { for error in errors.iter() { eprintln!("{error}") } }
Fixes
- Don’t panic in validation or omit diagnostics when a source location is missing - SimonSapin, pull/697:
In apollo-compiler 0.11 every element of the HIR always had a source location because it always came from a parsed input file. In 1.0 source location is always optional. When a node relevant to some diagnostic does not have a source location, the diagnostic should still be emitted but its labels (each printing a bit of source code) may be missing. Essential information should therefore be in the main message, not only in labels.