Skip to content

apollo-compiler@0.11.3

Choose a tag to compare

@goto-bus-stop goto-bus-stop released this 06 Oct 20:31
· 455 commits to main since this release
17fae0f

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 getName is defined multiple times
    • interface NamedEntity implements 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.