Skip to content

v4.0.0

Compare
Choose a tag to compare
@benmccallum benmccallum released this 30 Jan 15:38

This release changes the way validation errors are reported which results in a few breaking changes but gives us a lot more flexibility in the future.

Instead of collecting validation errors and then throwing an exception for an IErrorFilter to report the error, the validation errors are now passed over to a IValidationErrorsHandler (whose default implementation calls ReportError on each validation failure) and the middleware short-circuits.

Breaking changes:

  • Existing error filter removed.
    • To customize errors reported still you can substitute in your own IValidationErrorsHandler (potentially inheriting the default implementation and just overriding the CreateErrorBuilder, calling the base impl to create the default error and then the Set methods to customize some things).
  • The structure of the errors sent back has changed.
    • There's now (by default) an error item added per argument and per validation rule failure. If you want them grouped as before, you could do that also with a custom IValidationErrorsHandler and not loop over each like the default impl does.
  • IValidationErrorHandler removed (it wasn't doing anything and is replaced by IValidationErrorsHandler that does the error reporting; if anyone was using it, let me know and we can work out an alternative).