REST API Client Code Generator for VS 2019 Gallery feed (extension)
A collection of Visual Studio custom tools for generating a strongly typed REST API Client from an Open API / Swagger specification file
▼ Download- Author
- Christian Resma Helle
- Version
- 1.41.6929
- Updated
- 21 hours ago
- Tags
- OpenAPI; Swagger; NSwag; Refit; REST API; Code Generator
- Supports
- VS 2019
Packages are supplied by their publishers and are not built or reviewed by this gallery.
There is a separate VSIX installer available for Visual Studio 2022 and 2026, Visual Studio 2017, and Visual Studio Code
REST API Client Code Generator
A collection of Visual Studio C# custom tool code generators for Swagger / OpenAPI specification files
Features
- Supports Visual Studio 2017, 2019, 2022, 2026
- Add New REST API Client to a project from an OpenAPI specification URL (e.g https://petstore.swagger.io/v2/swagger.json) using the following code generators:
- Define custom namespace for the generated file
- Auto-updating of generated code file when changes are made to the OpenAPI specification JSON or YAML file
- Generate code using a configuration files using the following:
.nswagconfiguration files from NSwagStudio by including it in the project and using the Generate NSwag Studio output context menu.refittersettings files from Refitter by including it in the project and using the Generate Refitter output context menukiota-lock.jsonconfiguration files from Microsoft Kiota by including it in the project and using the Generate Kiota output context menu
Custom Tools
NSwagCodeGenerator - Generates a single file C# REST API Client using the NSwag.CodeGeneration.CSharp nuget package v14.7.1
OpenApiCodeGenerator - Generates a single file C# REST API Client using OpenAPI Generator v7.25.0. The output file is the result of merging all the files generated using the OpenAPI Generator tool with:
generate -g csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[default namespace] --skip-overwrite. It is possible to configure the OpenAPI Generator to generate multiple files which will be placed at the same path as the OpenAPI specifications document that was used to generate code, this is done under Tools -> REST API Client Code Generator -> OpenAPI Generator and setting Generate Multiple Files to trueKiotaCodeGenerator - Generates a single file C# REST API Client using the Microsoft project Kiota v1.34.1 generator. The output file is the result of merging all the files generated using the Kiota dotnet tool with:
generate -l CSharp -d [swagger file] -o [output file] -n [default namespace]. It is possible to configure Kiota to generate multiple files which will be placed at the same path as the OpenAPI specifications document that was used to generate code; this is done under Tools -> REST API Client Code Generator -> Kiota and setting Generate Multiple Files to trueSwaggerCodeGenerator - Generates a single file C# REST API Client using Swagger Codegen CLI v3.0.34. The output file is the result of merging all the files generated using the Swagger Codegen CLI tool with:
generate -l csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[default namespace] --skip-overwriteRefitterCodeGenerator - Generates a single file C# REST API Client interface for Refit using Refitter.Core nuget package v2.1.3. The output file contains a Refit interface generated by Refitter and contracts generated using NSwag.CodeGeneration.CSharp nuget package
Dependencies
The custom tool code generators piggy back on top of well known Open API client code generators like NSwag, OpenAPI Generator, Microsoft Kiota, Refitter, and Swagger Codegen CLI. These tools require .NET SDK and the Java Runtime Environment to be installed on the developers machine. Alternative Java SDK implementations such as the OpenJDK works fine with this extension. By default, the path to java.exe is read from the JAVA_HOME environment variable, but is also configurable in the Settings screen. Future versions of the extension will include the OpenJDK in the VSIX package
The Swagger Codegen CLI and OpenAPI Generator are distributed as JAR files and are downloaded on demand but requires the Java SDK to be installed on the machine. Microsoft Kiota is installed on-demand as a .NET Tool and requires .NET 7.0. This means that using these custom tools have an initial delay upon first time use.
NSwagStudio is stand alone UI tool for editing a .nswag specification file for generating code. This tool is optional to install and official installation instructions are available on the NSwag Wiki on Github. If NSwagStudio is not installed on the machine then the Visual Studio Extension will install the NSwag CLI as a .NET global tool from nuget.org using the latest available version.
The NSwag code generator produces code that depends on the Newtonsoft.Json NuGet package
The Refitter code generator produces code that depends on the Refit NuGet package
The OpenAPI Generator code generator produces code that depends on the following NuGet packages:
The project Kiota code generator produces code that depends on the following NuGet packages
- Microsoft.Kiota.Abstractions
- Microsoft.Kiota.Http.HttpClientLibrary
- Microsoft.Kiota.Serialization.Form
- Microsoft.Kiota.Serialization.Text
- Microsoft.Kiota.Serialization.Json
- Microsoft.Kiota.Serialization.Multipart
- Microsoft.Kiota.Authentication.Azure
- Azure.Identity
The Swagger Codegen CLI code generator produces code that depends on the RestSharp and JsonSubTypes NuGet packages
This Visual Studio Extension will automatically add the required NuGet packages that the generated code depends on
Screenshots






Settings
This extension will by default make some assumptions on the installation path for Java but also provides option pages for configuring this. The Swagger Codegen CLI and the OpenAPI Generator JAR files are by default downloaded to the user TEMP folder but it is also possible to specify to use existing JAR files

Supports customising how NSwag generates code using the properties exposed by the NSwag NuGet package

Supports customising how the .nswag file is generated using a subset of the options available in NSwag Studio

Supports customising how OpenAPI Generator generates code using the additional optional properties that the OpenAPI Generator CLI tool provides

Supports customising how Refitter generates the Refit interface. This allows you to configure whether to return the type directly or wrap it inside an IApiResponse<T>. You can also disable generating contracts or XML doc style comments

Supports allowing Kiota to generate multiple files

This extension collects errors and tracks feature usages to a service called Exceptionless and Azure Application Insights. This is done anonymously using a support key and a generated anonymous identity based on a secure hash of username@host

For tips and tricks on software development, check out my blog
If you find this useful and feel a bit generous then feel free to buy me a coffee :)