Hlibz.OpenApi.UseCases
2.0.0-preview.3
dotnet add package Hlibz.OpenApi.UseCases --version 2.0.0-preview.3
NuGet\Install-Package Hlibz.OpenApi.UseCases -Version 2.0.0-preview.3
<PackageReference Include="Hlibz.OpenApi.UseCases" Version="2.0.0-preview.3" />
<PackageVersion Include="Hlibz.OpenApi.UseCases" Version="2.0.0-preview.3" />
<PackageReference Include="Hlibz.OpenApi.UseCases" />
paket add Hlibz.OpenApi.UseCases --version 2.0.0-preview.3
#r "nuget: Hlibz.OpenApi.UseCases, 2.0.0-preview.3"
#:package Hlibz.OpenApi.UseCases@2.0.0-preview.3
#addin nuget:?package=Hlibz.OpenApi.UseCases&version=2.0.0-preview.3&prerelease
#tool nuget:?package=Hlibz.OpenApi.UseCases&version=2.0.0-preview.3&prerelease
![]()
Hlibz.OpenApi.UseCases
Publishes Hlibz.UseCases in OpenAPI documents built
with Microsoft.AspNetCore.OpenApi: what each use case checks, and the 400 an invalid one is
answered with.
dotnet add package Hlibz.OpenApi.UseCases
using Hlibz.OpenApi;
builder.Services.AddUseCases([typeof(CreateCityCommand).Assembly]);
builder.Services.AddOpenApi("v1", options => options
.AddXmlDocumentation() // Hlibz.OpenApi.AspNetCore, which this package brings
.AddUseCases(useCases => useCases.ValidationResponseType = typeof(ErrorResponse)));
- Every
IDescribedRule(a custom validation attribute) and[RuleSummary]becomes schema keywords plus a sentence indescriptionandx-rules, on the property, record parameter, parameter or type it sits on, through Hlibz.OpenApi.AspNetCore'sAddOpenApiRules(). - DataAnnotations on positional record parameters (
record CreateCityCommand([MaxLength(60)] string Name)) are published too: Microsoft.AspNetCore.OpenApi reads properties only. - An operation whose handler takes the handler of a use case that can fail validation gets a
400(HttpValidationProblemDetails, or the type you set), unless it documents one already (with Hlibz.Results, a typed error's400listsvalidation_failedalready:AddResults()).
Rules reach the document only on types the endpoint binds: bind the use case itself, or give it a record that is also the body.
Targets .NET 11. .NET 10 apps stay on 1.x.
A family of packages
One of five packages I build to set up new .NET APIs the way I want them: Hlibz.Results, Hlibz.UseCases, Hlibz.MinimalApi.Endpoints, Hlibz.OpenApi and Hlibz.Paging. Each works on its own, and they work best together, as in Hlibz.Stack. New minor and major versions come often, a new major whenever .NET gives me a better way to do something. Breaking changes only ever come in a major and are listed first in its release notes. You're welcome to use the packages, and to open an issue when something is wrong or missing.
Full documentation and samples: github.com/hlib-zinchenko/Hlibz.OpenApi.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Hlibz.OpenApi.AspNetCore (>= 2.0.0-preview.3)
- Hlibz.UseCases (>= 2.0.0-preview.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-preview.3 | 0 | 11/27/2026 |
| 2.0.0-preview.2 | 0 | 11/27/2026 |
| 2.0.0-preview.1 | 0 | 11/27/2026 |
| 1.1.0 | 75 | 11/25/2026 |
| 1.1.0-preview.2 | 63 | 11/23/2026 |
| 1.1.0-preview.1 | 68 | 11/22/2026 |