typedrest-codegen 0.1.0

dotnet tool install --global typedrest-codegen --version 0.1.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 typedrest-codegen --version 0.1.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=typedrest-codegen&version=0.1.0
                    
nuke :add-package typedrest-codegen --version 0.1.0
                    

TypedRest Code Generation CLI

Command-line tool that automatically infers TypedRest Endpoints from patterns in OpenAPI/Swagger documents and generates source code for TypedRest clients.

Make sure you have the .NET SDK installed and run:

dotnet tool install -g typedrest-codegen

If you build your client with the .NET SDK, consider the source generator instead. It runs the same generator during compilation, without writing files to your source tree.

For a walkthrough see the usage guide.

generate

Generates a TypedRest client.

typedrest-codegen generate -f myapi.yml -o myclient/ -s MyService --generate-interfaces --generate-dtos
Option Description Default
-f, --file (required) The path to the Swagger or OpenAPI spec file. Use - to read from standard input.
-o, --output (required) The directory to write the generated source code to.
-s, --service-name (required) The service name to use for the entry endpoint.
-n, --namespace The C# namespace for the endpoints. the service name
--dto-namespace The C# namespace for the DTOs. the endpoint namespace
--generate-interfaces Also generate interfaces for the endpoints. off
--generate-dtos Also generate DTOs for the schemas in the document. off
--lang-version The minimum C# version the generated DTOs must compile with, using the same values as the MSBuild LangVersion property. latest

Unlike the source generator, interfaces and DTOs are opt-in here. Generated endpoints reference the DTO types by name, so without --generate-dtos you have to provide those types yourself.

pattern

Runs only the inference step and writes the result back into the document as an x-typedrest extension, for inspecting or hand-editing what the tool infers.

typedrest-codegen pattern -f myapi.yml -o myapi-annotated.yml
Option Description Default
-f, --file (required) The path to the Swagger or OpenAPI spec file. Use - to read from standard input.
-o, --output The path of the spec file to write. Use - to write to standard output. overwrites the input file
--output-version The output version: OpenApi2_0 (Swagger) or OpenApi3_0. the version of the input
--output-format The output format: Yaml or Json. based on the output file ending

When a document already contains an x-typedrest extension, generate uses it as-is instead of re-running the inference.

Product 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.

This package has no dependencies.

Version Downloads Last Updated
0.1.0 38 8/1/2026