MinimalOpenAPI 1.0.0-beta.10

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

MinimalOpenAPI

MinimalOpenAPI is a contract-first OpenAPI framework for ASP.NET Core Minimal APIs.

You author the OpenAPI document first. MinimalOpenAPI reads it at build time and generates the C# scaffolding needed to implement the API.

What the package includes

What you get Notes
Roslyn source generator Generates DTOs, handler base classes, endpoint mapping, and DI registration at build time.
Runtime services Provides AddMinimalOpenApi(), MapMinimalOpenApiEndpoints(), and MapOpenApiSchemas().
YAML and JSON parser support Use <OpenApi Include="openapi.yaml" /> or <OpenApi Include="openapi.json" />.
Spec publishing support Copies authored OpenAPI files to build/publish output and can serve selected specs over HTTP.

Minimal setup

<ItemGroup>
  <PackageReference Include="MinimalOpenAPI" Version="1.0.0-beta.1" />
  <OpenApi Include="openapi.yaml" />
</ItemGroup>
using MinimalOpenAPI;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMinimalOpenApi();

var app = builder.Build();
app.MapMinimalOpenApiEndpoints();
app.Run();

Implement the generated abstract handler base class for each operation in your OpenAPI spec. The generator takes care of route mapping, handler registration, DTO generation, and endpoint metadata.

Generated contracts

MinimalOpenAPI generates DTO records from components/schemas.

By default, OpenAPI readOnly and writeOnly properties are respected through ReadWriteSchemaHandling="Auto":

<OpenApi Include="openapi.yaml"
         ReadWriteSchemaHandling="Auto" />

Supported values:

  • Ignore: parse readOnly / writeOnly, but keep neutral DTO shapes.
  • Auto: default. Generate request/response DTO variants only when direct or reachable readOnly / writeOnly properties require different shapes.
  • Split: generate request/response DTO graphs from operation body roots even when the current shapes are identical, preserving contract type names if directional properties are added later.

For example, with Account.id: readOnly and Account.password: writeOnly, generated operation signatures use AccountRequest and AccountResponse.

Publishing and serving specs

Every <OpenApi /> item is copied to build and publish output under an internal collision-safe path:

openapi/schemas/<SchemaId>/<filename>

To expose a spec over HTTP, configure PublishAs:

<OpenApi Include="openapi.yaml"
         PublishAs="/openapi/schema.yaml"
         DisplayName="Todo API"
         DisplayVersion="1.0.0" />

Then map schema endpoints:

app.MapMinimalOpenApiEndpoints();
var schemas = app.MapOpenApiSchemas();

Rules:

  • PublishAs must start with /.
  • PublishAs values must be unique across all <OpenApi /> items.
  • OpenAPI files without PublishAs are copied to output/publish, but are not served over HTTP.
  • DisplayName and DisplayVersion are optional descriptor metadata.

MapOpenApiSchemas() returns descriptors with PublicPath, Name, Version, FullName, and Endpoint, which can be used to configure Swagger UI, Scalar, or another OpenAPI UI package.

More documentation

For full documentation, samples, architecture notes, and release guidance, visit the repository:

https://github.com/Kralizek/MinimalOpenApi

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.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.

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
1.0.0-beta.10 47 5/11/2026
1.0.0-beta.9 57 5/9/2026
1.0.0-beta.8 57 4/18/2026
1.0.0-beta.7 48 4/7/2026
1.0.0-beta.6 54 4/6/2026
1.0.0-beta.5 54 4/5/2026
1.0.0-beta.4 49 4/5/2026
1.0.0-beta.3 53 4/5/2026
1.0.0-beta.2 57 4/4/2026
1.0.0-alpha 47 3/30/2026