NativeOpenApi 1.2.1
See the version list below for details.
dotnet add package NativeOpenApi --version 1.2.1
NuGet\Install-Package NativeOpenApi -Version 1.2.1
<PackageReference Include="NativeOpenApi" Version="1.2.1" />
<PackageVersion Include="NativeOpenApi" Version="1.2.1" />
<PackageReference Include="NativeOpenApi" />
paket add NativeOpenApi --version 1.2.1
#r "nuget: NativeOpenApi, 1.2.1"
#:package NativeOpenApi@1.2.1
#addin nuget:?package=NativeOpenApi&version=1.2.1
#tool nuget:?package=NativeOpenApi&version=1.2.1
Native.OpenApi
A collection of .NET libraries for OpenAPI 3.1 document management, optimized for Native AOT applications.
Packages
| Package | NuGet | Description |
|---|---|---|
| NativeOpenApi | OpenAPI document loading, linting, merging, and HTML rendering | |
| NativeOpenApiGenerator | Source Generator for automatic OpenAPI spec generation |
Overview
NativeOpenApi
Core library for working with OpenAPI 3.1 documents in Native AOT applications.
Features:
- 📄 Load OpenAPI specs from embedded resources (JSON and YAML)
- 🔀 Merge multiple partial specs into a consolidated document
- ✅ Lint and validate documents against configurable rules
- 📖 Generate Redoc and Scalar documentation pages
- ⚡ Full Native AOT compatibility
dotnet add package NativeOpenApi
var resourceReader = new OpenApiResourceReader(typeof(Program).Assembly, "MyApp.");
var loader = new MyOpenApiDocumentLoader(resourceReader);
var merger = new MyOpenApiDocumentMerger();
var linter = new OpenApiLinter(OpenApiLintOptions.Empty);
var provider = new OpenApiDocumentProvider(loader, merger, linter);
provider.WarmUp();
var json = provider.Document.Json;
NativeOpenApiGenerator
Roslyn Source Generator that automatically creates OpenAPI specifications from NativeLambdaRouter endpoints at compile time.
Features:
- 🔧 Compile-time generation (zero runtime overhead)
- 🔍 Automatic endpoint discovery from
MapGet,MapPost, etc. - 📝 Generates OpenAPI 3.1 compliant YAML
- 🏷️ Auto-generates operation IDs, tags, and security definitions
dotnet add package NativeOpenApiGenerator
// Endpoints are discovered automatically at build time
routes.MapGet<GetItemsCommand, GetItemsResponse>("/v1/items", ctx => new GetItemsCommand());
routes.MapPost<CreateItemCommand, CreateItemResponse>("/v1/items", ctx => Deserialize<CreateItemCommand>(ctx.Body!));
// Access the generated spec
string yaml = Native.OpenApi.Generated.GeneratedOpenApiSpec.Yaml;
Quick Start
Option 1: Document Loading & Merging Only
Use NativeOpenApi to load, merge, and serve your manually-written OpenAPI specs:
dotnet add package NativeOpenApi
Option 2: Automatic Generation + Loading
Use both packages together for automatic endpoint discovery combined with document management:
dotnet add package NativeOpenApi
dotnet add package NativeOpenApiGenerator
// Generated spec from your endpoints
var generatedYaml = Native.OpenApi.Generated.GeneratedOpenApiSpec.Yaml;
// Merge with common schemas and render documentation
var provider = new OpenApiDocumentProvider(loader, merger, linter);
var html = renderer.RenderRedoc("/openapi/v1/spec.json", "My API");
Project Structure
native-open-api/
├── src/
│ ├── Native.OpenApi/ # Core library
│ │ ├── OpenApiDocumentLoader.cs
│ │ ├── OpenApiDocumentMerger.cs
│ │ ├── OpenApiDocumentProvider.cs
│ │ ├── OpenApiLinter.cs
│ │ ├── OpenApiHtmlRenderer.cs
│ │ └── README.md
│ │
│ └── Native.OpenApi.Generator/ # Source Generator
│ ├── OpenApiSourceGenerator.cs
│ ├── OpenApiYamlGenerator.cs
│ └── README.md
│
└── tests/
├── Native.OpenApi.Tests/
└── Native.OpenApi.Generator.Tests/
Requirements
- .NET 10.0 or later
- C# 12.0 or later
Building from Source
git clone https://github.com/swepay/native-open-api.git
cd native-open-api
dotnet build
dotnet test
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
| 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. |
-
net10.0
- YamlDotNet (>= 16.3.0)
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.6.0 | 230 | 2/23/2026 |
| 1.5.1 | 168 | 2/19/2026 |
| 1.5.0 | 94 | 2/18/2026 |
| 1.4.1 | 84 | 2/18/2026 |
| 1.4.0 | 47 | 2/17/2026 |
| 1.3.3 | 117 | 2/13/2026 |
| 1.3.1 | 107 | 2/11/2026 |
| 1.3.0 | 55 | 2/11/2026 |
| 1.2.6 | 54 | 2/11/2026 |
| 1.2.5 | 53 | 2/11/2026 |
| 1.2.4 | 55 | 2/11/2026 |
| 1.2.3 | 57 | 2/9/2026 |
| 1.2.2 | 53 | 2/3/2026 |
| 1.2.1 | 58 | 2/3/2026 |
| 1.2.0 | 55 | 2/3/2026 |
| 1.1.0 | 60 | 2/2/2026 |
| 1.0.0 | 145 | 2/1/2026 |