MetaEngine.CSharp.OpenApi.HttpClient.Tool 1.0.1

dotnet tool install --global MetaEngine.CSharp.OpenApi.HttpClient.Tool --version 1.0.1
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local MetaEngine.CSharp.OpenApi.HttpClient.Tool --version 1.0.1
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MetaEngine.CSharp.OpenApi.HttpClient.Tool&version=1.0.1
                    
nuke :add-package MetaEngine.CSharp.OpenApi.HttpClient.Tool --version 1.0.1
                    

metaengine-openapi-csharp-httpclient

Generate idiomatic C# clients and models from an OpenAPI specification — HttpClient-based services and System.Text.Json models, with optional XML docs, DataAnnotations validation, retries, auth, and DI-ready middleware.

Powered by MetaEngine. Distributed as a .NET tool — install it with dotnet tool install and run it from the command line; no project reference required.

Install

# Global (available everywhere)
dotnet tool install -g MetaEngine.CSharp.OpenApi.HttpClient.Tool

# Or pin it to a repo (local tool manifest)
dotnet new tool-manifest        # once per repo
dotnet tool install MetaEngine.CSharp.OpenApi.HttpClient.Tool

Usage

metaengine-openapi-csharp-httpclient <input> <output> <namespace> [options]
Argument / Option Description
input OpenAPI specification file path or URL
output Output directory for generated C# files
namespace Root namespace for the generated client and models
--include-tags <tags> Only generate operations with these tags (comma-separated)
--service-suffix <name> Service naming suffix (e.g. Client, Api)
--options-threshold <n> Parameter count at which a method switches to an options object (default: 4)
--documentation Generate XML doc comments from schema descriptions and examples
--validation-annotations Emit System.ComponentModel.DataAnnotations attributes on models from spec constraints
--middleware Generate middleware infrastructure (ApiDelegatingHandler + ServiceCollectionExtensions)
--error-handling Enable smart error handling based on HTTP status semantics
--bearer-auth [env-var] Bearer token from an env var (default API_TOKEN); adds an Authorization header
--basic-auth Basic auth from env vars (API_USERNAME / API_PASSWORD)
--retries [max-attempts] Enable retries with exponential backoff; optional value sets max attempts
--custom-header <name=env-var> Static header from an env var. Repeatable
--strict-validation Enable strict OpenAPI validation
--clean Clean the destination directory before generating
--verbose Enable verbose logging

Example

metaengine-openapi-csharp-httpclient ./petstore.json ./Generated PetStore.Client \
  --documentation --validation-annotations --retries 3

Requirements

The .NET SDK (8.0 or newer) — the same toolchain you already use to build C#. The tool runs on any platform .NET supports (Linux, macOS, Windows).

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.

This package has no dependencies.

Version Downloads Last Updated
1.0.1 96 6/27/2026
1.0.0 102 6/25/2026