MinimalOpenAPI 1.1.0
dotnet add package MinimalOpenAPI --version 1.1.0
NuGet\Install-Package MinimalOpenAPI -Version 1.1.0
<PackageReference Include="MinimalOpenAPI" Version="1.1.0" />
<PackageVersion Include="MinimalOpenAPI" Version="1.1.0" />
<PackageReference Include="MinimalOpenAPI" />
paket add MinimalOpenAPI --version 1.1.0
#r "nuget: MinimalOpenAPI, 1.1.0"
#:package MinimalOpenAPI@1.1.0
#addin nuget:?package=MinimalOpenAPI&version=1.1.0
#tool nuget:?package=MinimalOpenAPI&version=1.1.0
MinimalOpenAPI
MinimalOpenAPI is a contract-first OpenAPI framework for ASP.NET Core Minimal APIs.
You author an OpenAPI 3.0 or 3.1 document in YAML or JSON. At build time, MinimalOpenAPI generates the C# contracts, handler base classes, dependency-injection registration, and endpoint mapping required to implement the API.
Requirements
- .NET 10
- ASP.NET Core
Minimal setup
<ItemGroup>
<PackageReference Include="MinimalOpenAPI" Version="1.0.0" />
<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 <OperationId>EndpointBase class for each operation. No manual route or handler registration is required.
What the package includes
- Roslyn incremental source generator
- ASP.NET Core runtime services
- YAML and JSON OpenAPI parsers
- contract records and enums
- typed handler signatures and results
- abstract endpoint configuration base classes applied after contract metadata
- authored-schema publishing support
MinimalOpenAPI is the only package consumers need. Parser and abstraction assemblies are bundled as implementation details.
Selected features
- OpenAPI 3.0 and 3.1
- YAML and JSON documents
- multiple documents per project
- component and inline object schemas
- inline objects used as array items
- enums, dictionaries, validation metadata, and
allOfflattening readOnlyandwriteOnlyrequest/response contract splitting- path, query, header, reusable, and path-level parameters
- parameter default values
- typed results and
application/problem+jsonwrappers - handler response filtering through
ExcludeStatusCodesFromHandlersand per-operationMinimalOpenApiHandlerinclude/exclude overrides - recursively nested ASP.NET Core
Results<>unions for more than six distinct effective handler result types - diagnostics MOA015–MOA017 for invalid handler responses, duplicate operation IDs, and unresolved or unsupported schema references
multipart/form-data,IFormFile, multiple files, and nested form objects- deterministic schema-name normalization with compile-time collision diagnostics
- explicit schema publication through
PublishAsandMapOpenApiSchemas()
Directional contracts
<OpenApi Include="openapi.yaml"
ReadWriteSchemaHandling="Auto" />
Ignorekeeps neutral contracts.Autocreates request/response variants only when reachablereadOnlyorwriteOnlyproperties require different shapes.Splitalways generates request and response graphs from operation body roots.
Publishing authored schemas
<OpenApi Include="openapi.yaml"
PublishAs="/openapi/schema.yaml"
DisplayName="Todo API"
DisplayVersion="1.0.0" />
app.MapMinimalOpenApiEndpoints();
var schemas = app.MapOpenApiSchemas();
The returned descriptors can be used to configure Swagger UI, Scalar, or another OpenAPI viewer. MinimalOpenAPI serves the authored document; it does not generate a second document from C# at runtime.
Handler response filtering
Configuration is layered: <OpenApi> sets document-level generation options,
<MinimalOpenApiHandler> sets generated handler responses for one operation,
and EndpointConfigurationBase provides runtime endpoint customization.
The handler item's Include is the OpenAPI operationId:
<ItemGroup>
<OpenApi Include="openapi.yaml" ExcludeStatusCodesFromHandlers="401;403" />
<MinimalOpenApiHandler Include="getOrder"
IncludeStatusCodes="403" ExcludeStatusCodes="409" />
</ItemGroup>
For multiple documents, OpenApiFile identifies the configured <OpenApi>
item path; basenames do not match paths in other directories:
<MinimalOpenApiHandler Include="getOrder"
OpenApiFile="contracts/orders/openapi.yaml"
ExcludeStatusCodes="409" />
OpenApiFile is optional with exactly one document and required with multiple
documents. An explicitly supplied path is always validated. Global exclusions
are applied before handler includes and excludes, with excludes taking
precedence. Status codes must be declared by the selected operation. Filtering
changes handler result types only; declared responses remain in endpoint
metadata.
More documentation
Full documentation, samples, limitations, architecture notes, and release guidance are available in the repository:
| Product | Versions 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. |
-
.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.1.0 | 206 | 10/3/2026 |
| 1.0.0 | 215 | 7/15/2026 |
| 1.0.0-rc.4 | 88 | 7/15/2026 |
| 1.0.0-rc.3 | 98 | 7/14/2026 |
| 1.0.0-rc.2 | 117 | 6/22/2026 |
| 1.0.0-rc.1 | 98 | 5/25/2026 |
| 1.0.0-beta.11 | 93 | 5/20/2026 |
| 1.0.0-beta.10 | 94 | 5/11/2026 |
| 1.0.0-beta.9 | 99 | 5/9/2026 |
| 1.0.0-beta.8 | 98 | 4/18/2026 |
| 1.0.0-beta.7 | 89 | 4/7/2026 |
| 1.0.0-beta.6 | 87 | 4/6/2026 |
| 1.0.0-beta.5 | 87 | 4/5/2026 |
| 1.0.0-beta.4 | 89 | 4/5/2026 |
| 1.0.0-beta.3 | 89 | 4/5/2026 |
| 1.0.0-beta.2 | 92 | 4/4/2026 |
| 1.0.0-alpha | 124 | 3/30/2026 |