MonadicTypes.NET.AspNetCore 0.3.0-preview.2

This is a prerelease version of MonadicTypes.NET.AspNetCore.
dotnet add package MonadicTypes.NET.AspNetCore --version 0.3.0-preview.2
                    
NuGet\Install-Package MonadicTypes.NET.AspNetCore -Version 0.3.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="MonadicTypes.NET.AspNetCore" Version="0.3.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MonadicTypes.NET.AspNetCore" Version="0.3.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="MonadicTypes.NET.AspNetCore" />
                    
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 MonadicTypes.NET.AspNetCore --version 0.3.0-preview.2
                    
#r "nuget: MonadicTypes.NET.AspNetCore, 0.3.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 MonadicTypes.NET.AspNetCore@0.3.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=MonadicTypes.NET.AspNetCore&version=0.3.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MonadicTypes.NET.AspNetCore&version=0.3.0-preview.2&prerelease
                    
Install as a Cake Tool

MonadicTypes.NET.AspNetCore

NativeAOT-compatible typed HTTP results, RFC problem responses, validation conversion, and endpoint metadata for MonadicTypes.NET. This package includes MonadicTypes.NET.Errors and the core package transitively.

Requirements

  • ASP.NET Core and .NET 10 or later
  • Minimal APIs are the primary reflection-free path
  • No runtime dependency on FluentValidation or an OpenAPI package

Install

dotnet add package MonadicTypes.NET.AspNetCore --prerelease

Quick Start

using Microsoft.AspNetCore.Http.HttpResults;
using MonadicTypes;
using MonadicTypes.AspNetCore;

public sealed record Customer(int Id);

static Results<Ok<Customer>, ProblemHttpResult> GetCustomer(int id)
{
    Result<Customer, Error> result = id > 0
        ? Result<Customer, Error>.Ok(new Customer(id))
        : Result<Customer, Error>.Fail(
            Error.NotFound("CUSTOMER_NOT_FOUND", "Customer was not found."));

    return result.ToHttpResult(static customer => TypedResults.Ok(customer));
}

app.MapGet("/customers/{id:int}", GetCustomer)
    .ProducesErrors(ErrorType.NotFound, ErrorType.Unexpected);

HTTP Contract

  • Built-in Error categories map to bounded default status codes.
  • Private messages and exception causes are not exposed by default.
  • ValidationErrors maps to a typed validation problem response.
  • Errors implementing IErrorConvertible<Error> can use the default policy.
  • Error.Custom values from 400 through 599 retain that status at this boundary; other custom numeric categories map to the generic 500 response.
  • Create, CreateExample, ToHttpResult, and error metadata accept explicit 400-through-599 overrides without changing the application error category.
  • Two-callback and IHttpResultMapper overloads are escape hatches for custom domain errors, status policies, or ProblemDetails shapes.
  • .ProducesErrors(...) adds Minimal API metadata; [ProducesError] provides controller metadata without requiring a runtime OpenAPI dependency.
  • .ProducesErrorCatalog(...) and [ProducesErrorCatalog] attach stable public error codes without taking a dependency on an OpenAPI document engine. Add MonadicTypes.NET.AspNetCore.OpenApi only when document transformation is required.

ErrorCatalogEntry rejects an uninitialized or undefined category and blank public fields. ErrorCatalogMetadata requires at least one entry, copies the input, rejects duplicate codes ordinally, and exposes the owned data through a zero-allocation readonly span. Larger catalogs use a bounded validation table while small and collision-heavy catalogs use a bounded linear fallback. OpenAPI transformation rejects duplicate codes across all metadata attached to one endpoint, even when statuses differ. Inline Minimal API entries should use explicit new ErrorCatalogEntry(...) construction for stable package-consumer inference.

ErrorProblemDetails.CreateExample(error) applies the normal response policy without reading ambient activity or request trace data. Use it for deterministic documentation and tests; Create(error, context) retains normal trace behavior. Registered HTTP errors receive stable titles and every status in the 400-through- 599 range receives a deterministic urn:problem-type:http-{status} identity. Unassigned statuses use the generic HTTP error title. Status-specific headers remain application policy.

Minimal API adapters return strongly typed results and are NativeAOT tested. Controller applications can use the metadata attribute and own their MVC result adapter because controller serialization and action-result policy vary by app.

Install MonadicTypes.NET.Async and MonadicTypes.NET.Effects separately when the endpoint pipeline needs them; this package does not force unrelated features into an API.

Package Add it for
MonadicTypes.NET.Async Task and ValueTask endpoint pipelines
MonadicTypes.NET.Effects Exception-producing dependencies
MonadicTypes.NET.Diagnostics Optional error tracing and metrics
MonadicTypes.NET.AspNetCore.OpenApi Reflection-free error catalog document transformation

Documentation

See ASP.NET Core usage and the compatibility contract.

Apache-2.0. Developed with AI assistance.

Complete API reference

Documented public members: 54

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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MonadicTypes.NET.AspNetCore:

Package Downloads
MonadicTypes.NET.AspNetCore.OpenApi

NativeAOT-compatible OpenAPI error-catalog documentation for MonadicTypes.NET ASP.NET Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0-preview.2 39 9/12/2026
0.3.0-preview.1 35 9/12/2026
0.2.0-preview.2 74 8/30/2026
0.2.0-preview.1 87 8/17/2026
0.1.0-preview.1 74 8/12/2026