OpenApiWeaver 1.0.0

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

OpenApiWeaver

CI Downloads NuGet License

OpenApiWeaver is an incremental Roslyn source generator that turns OpenAPI 3.x documents, including OpenAPI 3.2, into strongly typed C# HTTP clients at build time. No runtime code generation, no reflection - just plain C# emitted during compilation.

Quick Start

1. Install the package

<ItemGroup>
  <PackageReference Include="OpenApiWeaver" Version="x.y.z" PrivateAssets="all" />
</ItemGroup>

2. Add your OpenAPI document

<ItemGroup>
  <OpenApiWeaverDocument Include="openapi\petstore.yaml"
                         ClientName="PetstoreClient"
                         Namespace="Contoso.Generated" />
</ItemGroup>

Use OpenApiWeaverDocument rather than AdditionalFiles; the package's MSBuild targets project these items into compiler inputs automatically.

3. Use the generated client

var client = new PetstoreClient(accessToken: "your-token");

// Operations are grouped by OpenAPI tag
var pet = await client.Pets.GetAsync(petId: 1);

No extra dependencies are required — the package bundles the source generator and all analyzer assemblies.

Features

  • Incremental source generation — fast, cached rebuilds via the Roslyn incremental generator pipeline
  • OpenAPI 3.0-3.2 support — reads .json, .yaml, and .yml documents, including OpenAPI 3.2 features such as response summaries and nullable type arrays
  • Tag-based sub-clients — operations grouped by OpenAPI tags, exposed as properties on the root client
  • Typed request / response models — sealed classes, enums, nested inline types, dictionaries, and composition-aware schema mappings from components/schemas
  • Multiple request body formatsapplication/json, application/x-www-form-urlencoded, and multipart/form-data
  • Security scheme support — OAuth2 / Bearer tokens, API keys (header, query, cookie)
  • Runtime error handling — non-success responses throw OpenApiException, with typed OpenApiException<TError> when error schemas are available
  • OpenAPI-driven XML docs — IntelliSense comments generated from document, tag, operation, response, and schema metadata with HTML stripped automatically
  • Build-time diagnostics — errors and warnings reported as standard compiler diagnostics

Requirements

  • .NET SDK 8.0 or later

Documentation

For detailed guides, configuration options, and schema type mapping, visit the documentation site.

License

This project is licensed under the MIT License.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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 70 4/1/2026
1.0.0-preview9 72 3/31/2026
1.0.0-preview8 67 3/31/2026
1.0.0-preview7 71 3/30/2026
1.0.0-preview6 71 3/30/2026
1.0.0-preview5 75 3/30/2026
1.0.0-preview4 73 3/29/2026
1.0.0-preview3 77 3/29/2026