Repository navigation
2.0.0-preview.1
Pre-release
Pre-release
·
2 commits
to main
since this release
Breaking changes
- .NET 11 only, on Hlibz.Results 3.0. .NET 10 apps stay on 1.x.
- An invalid use case fails with the ambient
ValidationFailed.UseCaseValidationOptions.FailureStatusandFailureMessageare gone: the error carries its own status, and the HTTP layer picks400or422. - A filter's own failure must be an ambient error (
Forbidden,UnauthorizedorUnavailable) when the handler declares its errors. Any other error from a filter throws for such a handler.
Features
-
Handlers declare their errors.
IUseCaseHandler<TUseCase, TResult, TError>returnsResult<TResult, TError>, whereTErroris aunionof error types. Clients switch over the errors exhaustively, and documentation lists each one with its data.public union DeleteCityError(CityNotFound, CityInUse); public interface IDeleteCityCommandHandler : IUseCaseHandler<DeleteCityCommand, Unit, DeleteCityError>;
-
UseCaseDescriptor.ErrorSetTypenames a use case's error set, soIUseCaseCatalogtells adapters which errors each use case fails with. Hlibz.OpenApi.UseCases uses it for OpenAPI documents; an app can use it for MCP tools. -
The samples are plain minimal API endpoints on Hlibz.Results.AspNetCore only.
This is a preview: the API may still change before 2.0.0.
https://www.nuget.org/packages/Hlibz.UseCases/2.0.0-preview.1