REST API Client Code Generator

A collection of Visual Studio C# custom tool code generators for Swagger / OpenAPI specification files

🎯

Multiple Generators

Support for NSwag, OpenAPI Generator, Swagger Codegen, Refitter, Microsoft Kiota, and AutoRest

🔧

Visual Studio Integration

Seamless integration with Visual Studio 2017, 2019, 2022, VS Code, and Visual Studio for Mac

Auto-Update

Automatically regenerate client code when OpenAPI specification files change

🌐

Cross-Platform CLI

Command-line tool available for all platforms with .NET support

Getting Started

REST API Client Code Generator seamlessly integrates with your development workflow. Here's how to get started:

Add New REST API Client menu option

Add a new REST API Client from the Visual Studio context menu

OpenAPI specification URL dialog

Enter your OpenAPI specification URL and configure the generator settings

Supported Code Generators

NSwag

Version: v14.4.0

Generates clean, strongly-typed C# REST API clients using the NSwag.CodeGeneration.CSharp package. Features full async support, comprehensive error handling, and excellent integration with ASP.NET Core.

Dependencies: Newtonsoft.Json

OpenAPI Generator

Version: v7.14.0

Uses OpenAPI Generator to create comprehensive client libraries with extensive customization options. Supports multiple output formats and advanced configuration through additional properties.

Dependencies: RestSharp, JsonSubTypes, Polly, Newtonsoft.Json

Microsoft Kiota

Version: v1.27.0

Microsoft's modern API client generator with first-class support for Microsoft Graph and Azure APIs. Features strong typing, authentication patterns, and modern .NET practices.

Dependencies: Microsoft.Kiota.* packages, Azure.Identity

Refitter

Version: v1.6.0

Generates Refit interfaces for reactive REST clients. Perfect for applications using reactive patterns with comprehensive testing capabilities and clean interface design.

Dependencies: Refit

Swagger Codegen CLI

Version: v3.0.34

The original Swagger code generator with proven reliability and extensive language support. Ideal for legacy projects and established workflows.

Dependencies: RestSharp, JsonSubTypes

AutoRest

Version: v3.0.0-beta.20210504.2

Microsoft's AutoRest generator optimized for Azure services and general REST APIs. Includes advanced authentication, retry policies, and enterprise-grade reliability.

Dependencies: Microsoft.Rest.ClientRuntime, Newtonsoft.Json

Visual Studio Integration

Solution Explorer context menu

Context menu options in Solution Explorer for quick code generation

Auto-Update Features

  • Custom Tools Integration - Automatically regenerate client code when OpenAPI specification files change
  • Namespace Configuration - Define custom namespaces for generated files
  • Multiple File Support - Generate multiple files for complex APIs (OpenAPI Generator and Kiota)
  • Configuration File Support - Use .nswag, .refitter, and kiota-lock.json configuration files

Configuration File Support

NSwag Studio context menu

Generate code from NSwag Studio configuration files

Refitter configuration

Refitter configuration file integration

Kiota code generation

Microsoft Kiota configuration and code generation

Quick Start Guide

Get started with REST API Client Code Generator in just a few steps:

  1. Install the extension from the Visual Studio Marketplace for your IDE version
  2. Right-click your project in Solution Explorer and select "Add" → "REST API Client"
  3. Enter your OpenAPI specification URL (e.g., https://petstore.swagger.io/v2/swagger.json)
  4. Choose your preferred code generator (NSwag, OpenAPI Generator, Kiota, etc.)
  5. Configure the namespace and output filename
  6. Click Generate and start making API calls!

Cross-Platform Support

Visual Studio Code

VS Code context menu

VS Code integration with context menu support for JSON and YAML files

Visual Studio for Mac

VS Mac add new menu

Visual Studio for Mac integration

Command Line Tool

For automation and CI/CD scenarios, use our cross-platform command line tool:

# Install the global tool
dotnet tool install --global rapicgen

# Generate C# client using NSwag
rapicgen csharp nswag swagger.json MyNamespace ./MyClient.cs

# Generate TypeScript client
rapicgen typescript Angular swagger.json ./typescript-client

# Generate JMeter test plans
rapicgen jmeter swagger.json

Perfect for CI/CD Pipelines

  • GitHub Actions - Automatically regenerate clients when APIs change
  • Azure DevOps - Integrate with build pipelines
  • Jenkins - Add to existing CI workflows
  • Docker - Use in containerized build environments

Enterprise Ready

  • Dependency Management - Automatically adds required NuGet packages
  • Error Handling - Comprehensive error reporting and logging
  • Configuration - Extensive customization options for each generator
  • Analytics - Optional usage analytics to help improve the tool
  • Support - Active community and regular updates