NativeOpenApi 1.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NativeOpenApi --version 1.1.0
NuGet\Install-Package NativeOpenApi -Version 1.1.0
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="NativeOpenApi" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NativeOpenApi" Version="1.1.0" />
<PackageReference Include="NativeOpenApi" />
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 NativeOpenApi --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NativeOpenApi, 1.1.0"
#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 NativeOpenApi@1.1.0
#: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=NativeOpenApi&version=1.1.0
#tool nuget:?package=NativeOpenApi&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Native.OpenApi
OpenAPI 3.1 document loading, linting, merging, and rendering abstractions for .NET 10 Native AOT applications.
Features
- OpenAPI Document Loading: Load OpenAPI specs from embedded resources (JSON and YAML supported)
- YAML Support: Full support for YAML format with AOT-compatible parsing
- Document Merging: Merge multiple partial specs into a consolidated document
- Linting: Validate OpenAPI specs against configurable rules
- HTML Rendering: Generate Redoc and Scalar documentation pages
Installation
dotnet add package Native.OpenApi
Usage
1. Create your document loader
The loader automatically detects and parses both JSON (.json) and YAML (.yaml, .yml) files:
public class MyOpenApiDocumentLoader : OpenApiDocumentLoaderBase
{
public MyOpenApiDocumentLoader(OpenApiResourceReader resourceReader)
: base(resourceReader) { }
public override IReadOnlyList<OpenApiDocumentPart> LoadCommon()
{
return new List<OpenApiDocumentPart>
{
// YAML files
Load("common-schemas", "openapi/common/schemas.yaml"),
Load("common-responses", "openapi/common/responses.yaml"),
Load("common-security", "openapi/common/security.yaml")
};
}
public override IReadOnlyList<OpenApiDocumentPart> LoadPartials()
{
return new List<OpenApiDocumentPart>
{
// Mix of YAML and JSON files
Load("users", "openapi/users/openapi.yaml"),
Load("products", "openapi/products/openapi.json")
};
}
}
2. Create your document merger (optional)
public class MyOpenApiDocumentMerger : OpenApiDocumentMerger
{
protected override string GetServerUrl()
{
var env = Environment.GetEnvironmentVariable("ENVIRONMENT") ?? "dev";
return env switch
{
"prd" => "https://api.myapp.com",
"hml" => "https://api-staging.myapp.com",
_ => "https://localhost:5001"
};
}
protected override string GetApiTitle() => "My API";
protected override string GetApiDescription() => "My consolidated API documentation.";
}
3. Wire up the provider
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;
var yaml = provider.Document.Yaml;
4. Render documentation pages
var renderer = new OpenApiHtmlRenderer();
var redocHtml = renderer.RenderRedoc("/openapi/v1/spec.json", "My API Docs");
var scalarHtml = renderer.RenderScalar("/openapi/v1/spec.json", "My API Docs");
Linting Rules
Configure linting rules using OpenApiLintOptions:
var options = new OpenApiLintOptions(
RequiredErrorResponses: ["400", "401", "500"],
SensitiveFieldNames: ["password", "token", "secret"],
DisallowedGenericSegments: ["data", "items"]
);
var linter = new OpenApiLinter(options);
The linter validates:
- OpenAPI version is 3.1.0
- All paths include versioning (e.g.,
/v1/) - All operations have security definitions (JwtBearer or OAuth2)
- Required error responses are present
- Sensitive fields have descriptions
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
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 | 120 | 2/19/2026 |
| 1.5.0 | 94 | 2/18/2026 |
| 1.4.1 | 83 | 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 | 52 | 2/3/2026 |
| 1.2.1 | 57 | 2/3/2026 |
| 1.2.0 | 54 | 2/3/2026 |
| 1.1.0 | 59 | 2/2/2026 |
| 1.0.0 | 144 | 2/1/2026 |