sangria v1.3.0 Release Notes

Release Date: 2017-08-19 // about 5 years ago
  • Refactored exception handling mechanism:

    • Now it is able to handle Violations as well as UserFacingErrors.
    • HandledException is now able to capture multiple errors and additional AST node positions.
    • Since it is now a standalone class, it would be easier to expand on error handling in future.

    Minor breaking change. It's just a small syntax change. Migration strategy:

      // Before
      val exceptionHandler: Executor.ExceptionHandler = {
        case (m, ...) => ...
      })
    
      // After
      val exceptionHandler = ExceptionHandler {
        case (m, ...) => ...
      }
    

    ExceptionHandler is now a standalone class that allows you to provide following handlers:

    • onException - all unexpected exceptions coming from the resolve functions (behaves exactly like in earlier versions)
    • onViolation - handles violations (things like validation errors, argument/variable coercion, etc.)
    • onUserFacingError - handles standard sangria errors (errors like invalid operation name, max query depth, etc.)

    For more info see the updated "Custom ExceptionHandler" section of the documentation.

    • ๐Ÿ‘Œ Improved input document validation and deserialization (#272). For more info see "Input Document Validation" section of the documentation and updated "Query AST Marshalling" section. Improvements include:
      • Added InputDocument which is used in validation, materialization, etc.
      • New macros gqlInpDoc/graphqlInputDoc that produces an InputDocument instead of just sangria.ast.Value.
      • Added RuleBasedQueryValidator.validateInputDocument that validates InputDocument against the schema.
      • InputDocument.to provide a convenient way to deserialize/materialize an input document based on the FromInput type-class.
      • Improved a lot of validation messages related to input value validations.
    • โž• Add support for leading vertical bar in union types and directive definitions (#253) (spec change).
    • ๐Ÿ›  Fixed infinite loop on invalid queries in OverlappingFields (#266, #238).
    • Information about type extensions is now available in the field resolve function builder (#267). Minor breaking change. The signature of DefaultAstSchemaBuilder.buildField and DefaultAstSchemaBuilder.resolveField has changed. You need to add extensions: Vector[ast.TypeExtensionDefinition] as a second argument.
    • ๐Ÿ›  Fixed directive definition rendering in query renderer (#274). Thanks to @alexeygolev for this contribution!
    • Built-in scalars will now only be added to the schema if they are used (#271, #270). Thanks to @jlawrienyt for this contribution!
    • ๐Ÿ‘Œ Improve error message when an appropriate implementation of an abstract type cannot be found (#259).