Hlibz.OpenApi.UseCases 2.0.0-preview.2

This is a prerelease version of Hlibz.OpenApi.UseCases.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Hlibz.OpenApi.UseCases --version 2.0.0-preview.2
                    
NuGet\Install-Package Hlibz.OpenApi.UseCases -Version 2.0.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hlibz.OpenApi.UseCases" Version="2.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hlibz.OpenApi.UseCases" Version="2.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Hlibz.OpenApi.UseCases" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hlibz.OpenApi.UseCases --version 2.0.0-preview.2
                    
#r "nuget: Hlibz.OpenApi.UseCases, 2.0.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hlibz.OpenApi.UseCases@2.0.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hlibz.OpenApi.UseCases&version=2.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Hlibz.OpenApi.UseCases&version=2.0.0-preview.2&prerelease
                    
Install as a Cake Tool

Hlibz.OpenApi.UseCases icon

Hlibz.OpenApi.UseCases

NuGet CI

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 in description and x-rules, on the property, record parameter, parameter or type it sits on, through Hlibz.OpenApi.AspNetCore's AddOpenApiRules().
  • 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's 400 lists validation_failed already: 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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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