DarkPatterns.OpenApiCodegen.Client.TypeScript 0.12.2

dotnet tool install --global DarkPatterns.OpenApiCodegen.Client.TypeScript --version 0.12.2
                    
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 DarkPatterns.OpenApiCodegen.Client.TypeScript --version 0.12.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=DarkPatterns.OpenApiCodegen.Client.TypeScript&version=0.12.2
                    
nuke :add-package DarkPatterns.OpenApiCodegen.Client.TypeScript --version 0.12.2
                    

OpenAPI Codegen for a TypeScript-friendly Open API clients

Use an OpenAPI specification to generate generalized TypeScript objects for creating clients of many shapes.

dotnet tool install -g DarkPatterns.OpenApiCodegen.Client.TypeScript

This will provide a corresponding bin to generate the typescript files.

openapi-codegen-typescript api.yaml api-generated/ -c

The above example will take as input an api.yaml, output an api-generated/ folder with all the typescript files and a gitignore. You should add this as part of your CI process with only the OpenAPI spec checked in, or download the spec as part of the CI process.

Written in C#.

CLI arguments

Ordered arguments:

  1. input-openapi-document - path to the OpenAPI Schema.
  2. output-path - path to the output directory where files will be placed.
Switch Description
-?, -h, --help Display help
-o <path>, --options <path> Provides path to an Options file, see below
-x, --exclude-gitignore Do not emit a .gitignore file
-c, --clean Remove all files in the output directory before generating.

Options file

While the full structure of the yaml can be seen within the source repository, commonly, only one or two parameters are needed. Missing keys are merged with the defaults. For example:

mapType: Record<string, {}>
arrayType: Array<{}>
fallbackType: any
types:
  number:
  string:
    formats:
      binary: Blob
    default: string
  • mapType specifies the type to use for JSON maps, which occur when when additionalProperties is specified. {} is used as a placeholder for the type.
  • arrayType specifies the type to use for JSON arrays. {} is used as a placeholder for the type.
  • fallbackType specifies the type to use when a schema is unable to be emitted. Other recommended options are unknown and never.
  • types must be an object with keys that correspond to the JSON Schema type properties. Within, the configuration may specify either the default (for if the format is either not specified or not found) or custom formats. Note that this only changes the type of the generated
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
0.12.2 189 6/1/2025