REST API Client Code Generator
A collection of Visual Studio C# custom tool code generators for Swagger / OpenAPI specification files
The custom tool code generators piggy back on top of well known Open API client code generators like AutoRest, NSwag, OpenAPI Generator, and Swagger Codegen CLI. These tools require NPM 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
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. AutoRest is installed on-demand via NPM as a global tool and uses the latest available version. 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 via NPM as a global tool using the latest available version.
The NSwag code generator produces code that depends on the Newtonsoft.Json NuGet package
This Visual Studio Extension will automatically add the required NuGet packages that the generated code depends on
This extension will by default make some assumptions on the installation paths for Java, NSwag and NPM 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 AutoRest generates code based on the C# generator settings that the AutoRest CLI tool provides
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
This extension collects errors and tracks feature usages to a service called Exceptionless. 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 :)