Namespace Magicalizer.Api
Classes
- FluentValidationFilterAttribute
Validates action arguments with the registered FluentValidation validators (FluentValidation.IValidator<T>) before the action is executed and adds validation errors to the model state. Asynchronous validation rules are supported. The rule sets to validate are set by ValidationRuleSetAttribute on the parameter. It runs before ApiControllerAttribute rejects the requests with the model state errors, so the client gets all the errors of the request at once.
- ModelExceptionFilterAttribute
Converts the exceptions of the model services to the responses:
- FluentValidation.ValidationException to 400 Bad Request with the validation errors.
- ModelNotFoundException to 404 Not Found.
- ModelAlreadyExistsException and ModelInUseException to 409 Conflict.
Other exceptions aren't handled.
- QueryStringValidationFilterAttribute
Adds the model state errors for the query parameters the action doesn't support (e.g. a misspelled filter condition) and for the invalid collection conditions (the list form with gaps in the indexes or combined with the single form), as the response would have the objects the client didn't ask for. The parameters of IgnoredQueryParameters are allowed anyway. It runs before ApiControllerAttribute rejects the requests with the model state errors, so the client gets all the errors of the request at once.
- ValidationRuleSetAttribute
FluentValidation rule sets that FluentValidationFilterAttribute validates an action parameter with. Without the attribute, only the default rules are validated.