Skip to content

v1.3.0

Compare
Choose a tag to compare
@OlegIlyenko OlegIlyenko released this 19 Aug 18:22
· 1505 commits to main since this release
  • Experimental Batch Executor (#273). For more info see the "Batch Executor" section of the documentation.

  • Allow Violations and UserFacingErrors to be handled by custom exception handler (#252).

    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).