MetaEngine.CSharp.GraphQL.HttpClient.Tool 1.0.0

dotnet tool install --global MetaEngine.CSharp.GraphQL.HttpClient.Tool --version 1.0.0
                    
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.GraphQL.HttpClient.Tool --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MetaEngine.CSharp.GraphQL.HttpClient.Tool&version=1.0.0
                    
nuke :add-package MetaEngine.CSharp.GraphQL.HttpClient.Tool --version 1.0.0
                    

metaengine-graphql-csharp-httpclient

Generate idiomatic C# clients and models from a GraphQL schema (SDL) — HttpClient-based query/mutation/subscription services and System.Text.Json models, with optional XML docs, named fragments, 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.GraphQL.HttpClient.Tool

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

Usage

metaengine-graphql-csharp-httpclient <input> <output> <namespace> [options]
Argument / Option Description
input GraphQL schema (SDL) file path or inline SDL content
output Output directory for generated C# files
namespace Root namespace for the generated client and models
--options-threshold <n> Collapse an operation's arguments into a single options object once it has at least <n> of them (default 4)
--documentation Generate XML doc comments from GraphQL SDL descriptions
--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
--subscription-url <path> Path appended to the WebSocket base URL for GraphQL subscriptions (default /graphql)
--fragments Emit reusable named fragments for object-type selections
--oneof-inputs Generate idiomatic @oneOf input types (tagged-union inputs)
--custom-scalar <GraphQLScalar=DotNetType> Map a GraphQL custom scalar to a fully-qualified .NET type (e.g. DateTime=System.DateTime). Repeatable
--include-types <types> Only generate these GraphQL types (comma-separated type names)
--clean Clean the destination directory before generating
--verbose Enable verbose logging

Example

metaengine-graphql-csharp-httpclient ./schema.graphql ./Generated Shop.Client \
  --documentation --fragments --custom-scalar DateTime=System.DateTime --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.0 96 6/26/2026