Kawa.Abstractions 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Kawa.Abstractions --version 0.1.1
                    
NuGet\Install-Package Kawa.Abstractions -Version 0.1.1
                    
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="Kawa.Abstractions" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kawa.Abstractions" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Kawa.Abstractions" />
                    
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 Kawa.Abstractions --version 0.1.1
                    
#r "nuget: Kawa.Abstractions, 0.1.1"
                    
#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 Kawa.Abstractions@0.1.1
                    
#: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=Kawa.Abstractions&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Kawa.Abstractions&version=0.1.1
                    
Install as a Cake Tool

Design Principles

Kawa is a contract-first .NET web framework that lays a thin waterway on top of ASP.NET Core.

Kawa keeps application flow centered on request/response contracts and use cases. ASP.NET Core stays as the host and transport layer; Kawa only provides the small boundary pieces needed to execute use cases and translate KawaResult<T> values into HTTP responses.

Packages

  • Kawa.Abstractions: shared use case, result, and error contracts
  • Kawa.Core: transport-independent use case execution
  • Kawa.Web: ASP.NET Core Minimal API integration
  • Kawa.FSharp: F# helpers

Installation

dotnet add package Kawa.Web

Kawa.Web brings in the core Kawa runtime pieces needed for ASP.NET Core Minimal API integration.

Quick Start

Define request and response contracts:

public sealed record CreateUserRequest(string Name);

public sealed record CreateUserResponse(string Message);

Implement a use case:

using Kawa.Abstractions;

public sealed class CreateUserUseCase
    : IUseCase<CreateUserRequest, CreateUserResponse>
{
    public Task<KawaResult<CreateUserResponse>> ExecuteAsync(
        CreateUserRequest request,
        CancellationToken cancellationToken = default)
    {
        if (string.IsNullOrWhiteSpace(request.Name))
        {
            var error = new KawaError(KawaErrorKind.Validation, "Name is required.");
            return Task.FromResult(KawaResult<CreateUserResponse>.Failure(error));
        }

        var response = new CreateUserResponse($"Created user {request.Name}.");
        return Task.FromResult(KawaResult<CreateUserResponse>.Success(response));
    }
}

Register Kawa, register the use case, and map it as a Minimal API endpoint:

using Kawa.Abstractions;
using Kawa.Web;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddKawa();
builder.Services.AddSingleton<IUseCase<CreateUserRequest, CreateUserResponse>, CreateUserUseCase>();

var app = builder.Build();

app.MapKawaPost<CreateUserRequest, CreateUserResponse>("/users");

app.Run();

Then call the endpoint:

curl -X POST http://localhost:5000/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Louisa"}'

Result to HTTP Mapping

MapKawaPost<TRequest,TResponse> resolves the matching IUseCase<TRequest,TResponse> from dependency injection, executes it through UseCaseExecutor, and converts the result to an ASP.NET Core IResult.

Current failure mappings:

KawaErrorKind HTTP response
Validation 400 Bad Request
Unauthorized 401 Unauthorized
Forbidden 403 Forbidden
NotFound 404 Not Found
Conflict 409 Conflict
Unknown 500 Problem

Samples

Run the C# sample:

dotnet run --project samples/Kawa.Sample.CSharp

Run the mixed C# host + F# use case sample:

dotnet run --project samples/Kawa.Sample.Mixed

Run the mixed C# host + VB.NET use case sample:

dotnet run --project samples/Kawa.Sample.VB

All samples expose POST /users.

Development

Restore, build, and test:

dotnet restore Kawa.sln
dotnet build Kawa.sln --no-restore
dotnet test Kawa.sln --no-restore --no-build

Run tests with coverage:

dotnet test Kawa.sln \
  --no-restore \
  --no-build \
  --collect:"XPlat Code Coverage" \
  --results-directory TestResults \
  -- \
  DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura

The CI pipeline audits NuGet packages during restore and uploads coverage to Codecov. Project and patch coverage are configured to target 100%.

To create local NuGet packages:

bash eng/pack.sh

To publish the generated packages to NuGet.org:

NUGET_API_KEY=... bash eng/push-nuget.sh

NuGet releases are also published by GitHub Actions when a tag in vX.Y.Z format is pushed, for example:

git tag v0.1.1
git push origin v0.1.1

The release workflow uses the repository secret NUGET_API_KEY.

See:

License

Kawa is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Kawa.Abstractions:

Package Downloads
Kawa.Core

Core execution pipeline for transport-independent Kawa use cases.

Kawa.Web

ASP.NET Core Minimal API adapter for executing Kawa use cases over HTTP.

Kawa.FSharp

F# helpers for using Kawa results and use case contracts from F# code.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 149 7/30/2026
0.3.1 169 6/22/2026
0.3.0 158 5/27/2026
0.2.1 131 5/26/2026
0.2.0 132 5/26/2026
0.1.1 149 5/24/2026
0.1.0 144 5/22/2026