apollo-compiler@0.11.3
Features
-
expose line/column location and JSON format from diagnostics, by goto-bus-stop in pull/668
You can now use
diagnostic.get_line_column()to access the line/column number where a validation error occurred.diagnostic.to_json()returns a GraphQL error structure that's serializable with serde, matching the JSON error format.let diagnostics = compiler.db.validate(); let errors = diagnostics.into_iter().map(ApolloDiagnostic::to_json).collect::<Vec<_>>(); let error_response = serde_json::to_string(&serde_json::json!({ "errors": errors, }))?;
-
improve validation error summaries, by goto-bus-stop in pull/674
Adds more context and a more consistent voice to the "main" message for validation errors. They are now concise,
matter-of-fact descriptions of the problem. Information about how to solve the problem is usually already provided
by labels and notes on the diagnostic.- operation
getNameis defined multiple times - interface
NamedEntityimplements itself
The primary use case for this is to make
diagnostic.data.to_string()return a useful message for text-only error
reports, like in JSON responses. The JSON format for diagnostics uses these new messages. - operation