Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>REST API Client Code GeneratorNew to Visual Studio Code? Get it now.
REST API Client Code Generator

REST API Client Code Generator

Christian Resma Helle

|
5 installs
| (0) | Free
Generate REST API client code from OpenAPI/Swagger specifications
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

REST API Client Code Generator

A VS Code extension for generating C# REST API clients from OpenAPI/Swagger specifications.

Installation

You can install this extension in several ways:

  1. VS Code Marketplace: Search for "REST API Client Code Generator" in the VS Code Extensions view.

  2. Manual Installation:

    • Download the .vsix file from the GitHub releases page
    • In VS Code, go to Extensions view
    • Click on "..." menu in the top right corner
    • Select "Install from VSIX..."
    • Locate and select the downloaded .vsix file
  3. Build from Source:

    git clone https://github.com/christianhelle/apiclientcodegen.git
    cd apiclientcodegen
    ./src/build-vscode.ps1
    

    Then install the generated .vsix file using the method above.

Features

This extension adds a context menu item REST API Client Code Generator when right-clicking on JSON or YAML files in the VS Code explorer. The context menu provides the following code generation options:

  • NSwag: Generates a C# REST API Client using NSwag
  • Refitter: Generates a C# Refit interface using Refitter
  • OpenAPI Generator: Generates a C# REST API Client using OpenAPI Generator
  • Microsoft Kiota: Generates a C# REST API Client using Microsoft Kiota
  • Swagger Codegen CLI: Generates a C# REST API Client using Swagger Codegen CLI
  • AutoREST: Generates a C# REST API Client using AutoREST

Screenshot

REST API Client Code Generator VS Code Extension

Requirements

  • .NET SDK 6.0 or higher
  • Java Runtime Environment (for OpenAPI Generator and Swagger Codegen CLI)
  • NPM (for AutoREST and NSwag)

The extension uses the rapicgen .NET tool to generate the code. If not already installed, you will be prompted to install it when first attempting to generate code.

Extension Settings

This extension contributes the following settings:

  • restApiClientCodeGenerator.namespace: Default namespace to use in generated code (default: "GeneratedCode")
  • restApiClientCodeGenerator.outputDirectory: Output directory relative to workspace folder (default: same directory as the specification file)

How to Use

  1. Right-click on a Swagger/OpenAPI specification file (JSON or YAML) in the VS Code explorer
  2. Select "REST API Client Code Generator" in the context menu
  3. Choose one of the available code generators
  4. The generated C# code will be saved and opened in the editor

Dependencies

The code generated by each generator depends on different NuGet packages:

  • NSwag: Depends on Newtonsoft.Json
  • Refitter: Depends on Refit
  • OpenAPI Generator: Depends on RestSharp, JsonSubTypes, Polly, Newtonsoft.Json
  • Microsoft Kiota: Depends on Microsoft.Kiota.* packages and Azure.Identity
  • Swagger Codegen CLI: Depends on RestSharp and JsonSubTypes
  • AutoREST: Depends on Microsoft.Rest.ClientRuntime and Newtonsoft.Json

Related

  • This extension is the VS Code equivalent of the REST API Client Code Generator extension for Visual Studio.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft