All Projects → christianhelle → Apiclientcodegen

christianhelle / Apiclientcodegen

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

Projects that are alternatives of or similar to Apiclientcodegen

Apipie
Transform api declaration to js object for frontend. Inspired by VueRouter, koa-middleware and axios.
Stars: ✭ 29 (-42%)
Mutual labels:  api-client, rest-client
sevenbridges-python
SevenBridges Python Api bindings
Stars: ✭ 41 (-18%)
Mutual labels:  api-client, rest-client
YuiAPI
一个浏览器API测试客户端,API文档生成器,支持chrome/firefox/新版edge
Stars: ✭ 25 (-50%)
Mutual labels:  api-client, rest-client
Parse Dashboard For Ios
A beautiful mobile client for managing your Parse apps while you are on the go! Now you can easily view and modify your data in the same way you would on the offical desktop client.
Stars: ✭ 81 (+62%)
Mutual labels:  api-client, rest-client
radiobrowser4j
RadioBrowser Java API library
Stars: ✭ 30 (-40%)
Mutual labels:  api-client, rest-client
Ng Swagger Gen
A Swagger 2.0 codegen for Angular
Stars: ✭ 196 (+292%)
Mutual labels:  api-client, code-generator
restofus
Restofus - a cross-platform (REST) API client.
Stars: ✭ 18 (-64%)
Mutual labels:  api-client, rest-client
NClient
💫 NClient is an automatic type-safe .Net HTTP client that allows you to call web service API methods using annotated interfaces or controllers without boilerplate code.
Stars: ✭ 25 (-50%)
Mutual labels:  api-client, rest-client
RESTEasy
REST API calls made easier
Stars: ✭ 12 (-76%)
Mutual labels:  api-client, rest-client
bitrix
Bitrix24 REST API client that doesn't suck. Suffer no more.
Stars: ✭ 59 (+18%)
Mutual labels:  api-client, rest-client
Openapi Generator
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
Stars: ✭ 10,634 (+21168%)
Mutual labels:  api-client, rest-client
Autorest
OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python
Stars: ✭ 3,607 (+7114%)
Mutual labels:  rest-client, code-generator
Openapi Cli Generator
Generate a CLI from an OpenAPI 3 specification
Stars: ✭ 121 (+142%)
Mutual labels:  rest-client, code-generator
drowsy
😪 Lazy integrations tool for RESTful interfaces to aid POC development and streamline integrations
Stars: ✭ 19 (-62%)
Mutual labels:  api-client, rest-client
apiron
🍳 apiron is a Python package that helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP.
Stars: ✭ 106 (+112%)
Mutual labels:  api-client, rest-client
Taviloglu.Wrike.ApiClient
.NET Client for Wrike API
Stars: ✭ 24 (-52%)
Mutual labels:  api-client, rest-client
Datafire
A framework for building integrations and APIs
Stars: ✭ 487 (+874%)
Mutual labels:  api-client, rest-client
Adyen Ruby Api Library
Adyen API Library for Ruby
Stars: ✭ 35 (-30%)
Mutual labels:  api-client
Dogen
Reference implementation of the MASD Code Generator.
Stars: ✭ 44 (-12%)
Mutual labels:  code-generator
Cricinfo
Python library for accessing information from http://cricinfo.com (Live scores and updates)
Stars: ✭ 32 (-36%)
Mutual labels:  api-client

Build status CLI Tool VSIX VS Mac Smoke Tests Azure Pipelines

Maintainability Rating Reliability Rating Security Rating Bugs Vulnerabilities Quality Gate Status

Version Installs Rating Join the chat at https://gitter.im/apiclientcodegen/community

NuGet NuGet

buymeacoffee

REST API Client Code Generator

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

Download

Download the latest version for Windows from the Visual Studio Marketplace or the latest version for Mac (.mpack) from the Release page. Follow these instructions for update convenience on Visual Studio for Mac

Features

Custom Tools

  • AutoRestCodeGenerator - Generates a single file C# REST API Client using AutoRest. The resulting file is the equivalent of using the AutoRest CLI tool with: --csharp --input-file=[swaggerFile] --output-file=[outputFile] --namespace=[namespace] --add-credentials

  • NSwagCodeGenerator - Generates a single file C# REST API Client using the NSwag.CodeGeneration.CSharp nuget package v13.10.8

  • SwaggerCodeGenerator - Generates a single file C# REST API Client using Swagger Codegen CLI v3.0.14. The output file is the result of merging all the files generated using the Swagger Codegen CLI tool with: generate -l csharp --input-spec [swaggerFile] --output [output] -DapiTests=false -DmodelTests=false -DpackageName=[namespace] --skip-overwrite

  • OpenApiCodeGenerator - Generates a single file C# REST API Client using OpenAPI Generator v5.0.1. The output file is the result of merging all the files generated using the OpenAPI Generator tool with: generate -g csharp --input-spec [swaggerFile] --output [output] -DapiTests=false -DmodelTests=false -DpackageName=[namespace] --skip-overwrite

Dependencies

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 OpenAPI Generator and Swagger Codegen CLI code generators produces code that depends on the RestSharp and JsonSubTypes NuGet packages

The AutoRest code generator produces code that depends on the Microsoft.Rest.ClientRuntime and Newtonsoft.Json NuGet packages

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

Screenshots

Add - API Client from OpenAPI Specification

Enter URL to OpenAPI Specification

Solution Explorer Context Menus

NSwag Studio Context Menu

Settings

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

Options - General

Supports customising how AutoRest generates code based on the C# generator settings that the AutoRest CLI tool provides

Options - AutoRest

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

Options - NSwag

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

Options - NSwag Studio

Visual Studio for Mac

Add - API Client from OpenAPI Specification

Enter URL to OpenAPI Specification

Solution Explorer Context Menus

NSwag Studio Context Menu

Installation

The Visual Studio extension can be installed directly from Visual Studio 2017 or 2019 via the Extensions Dialog Box. The process is best described in the official Microsoft documentation for Managing extensions for Visual Studio

Visual Studio for Mac

This installation process for Visual Studio for Mac is currently a bit troublesome as the MonoDevelop Addin Repository is currently not accepting new users so I can't really register and setup my extension.

There are 2 ways of installing my extension on Visual Studio for Mac: Adding a custom extension repository or Installing the .mpack file directly from the Extensions Manager

Adding a new extension repository

Here's what you need to do:

  • Open the Visual Studio for Mac Extension Manager
  • You can do this from the menu Visual Studio -> Extentions

Open Extensions Dialog Box

  • Select the Gallery Tab
  • Expand the Repository drop down box and select Manage Repositories

Manage Repositories

  • Press on the Add button to add a new custom extension repository

Manage Repositories

Add Repository

  • Now my extension repository is added to the list
  • Make sure that this is enabled (indicated by a check box)

Add Repository Dialog

  • You should now be able to see my extensions from the Gallery tab

Added Repository

  • By adding my extension repository you will be able to conveniently update my extension using the Visual Studio for Mac Extension Manager

Add Repository

Add Repository

Add Repository

Installing the .mpack file directly

Here's what you need to do:

  • Download the latest .mpack file from the Latest Github Release
  • Now from within Visual Studio for Mac you need to launch the Extensions Dialog Box. You can do this from the menu Visual Studio -> Extentions

Open Extensions Dialog Box

  • Click on the Install from File button

Manually install .mpack file

  • Browse to the .mpack file and select it. You will be prompted with a confirmation dialog

Confirm .mpack file install

  • Click Install and restart Visual Studio for Mac

  • To Verify that the Add-in was installed you can re-open the Extensions Dialog Box, select the Installed tab and expand the IDE Extensions. You should be able to see the REST API Client Code Generator.

  • Uninstalling the Add-in is done in this same dialog box by clicking the Uninstall button

Manually uninstall Add-in

Cross Platform Command Line Tool

All custom tools mentioned above are also implemented in a cross platform command line application

Requirements

  • .NET Core 2.1 runtime
  • Java Runtime Environment
  • NPM

Installation

The tool can be installed as a .NET Core global tool that you can call from the shell / command line

dotnet tool install --global rapicgen

or by following the instructions here to install a specific version of tool

Usage

Since the tool is published as a .NET Core Tool, it can be launched from anywhere using any command line interface by calling rapicgen. The help information is displayed when not specifying any arguments to rapicgen

Usage: run [options] [command]

Options:
  -v|--verbose  Show verbose output
  -?|-h|--help  Show help information

Commands:
  autorest      Generate Swagger / Open API client using AutoRest
  nswag         Generate Swagger / Open API client using NSwag
  openapi       Generate Swagger / Open API client using OpenAPI Generator
  swagger       Generate Swagger / Open API client using Swagger Codegen CLI

Run 'run [command] --help' for more information about a command.

Some help information is also provided per command and can be launched by

$ rapicgen [command name] -?

For example:

$ rapicgen autorest -?

will output this:

Generate Swagger / Open API client using AutoRest

Usage: run autorest [options] <swaggerFile> <namespace> <outputFile>

Arguments:
  swaggerFile   Path to the Swagger / Open API specification file
  namespace     Default namespace to in the generated code
  outputFile    Output filename to write the generated code to. Default is the swaggerFile .cs

Options:
  -?|-h|--help  Show help information

Usage Examples:

Let's say we have a OpenAPI Specifications document called Swagger.json

For starters, we can use the Swagger Petstore spec. Here's an example powershell script for downloading it

Invoke-WebRequest -Uri https://petstore.swagger.io/v2/swagger.json -OutFile Swagger.json

In case you don't have the CLI tool installed you can install it by

dotnet tool install --global rapicgen

Here's an example of how to generate code using AutoRest

rapicgen autorest Swagger.json GeneratedCode ./AutoRestOutput.cs

Here's an example of how to generate code using NSwag

rapicgen nswag Swagger.json GeneratedCode ./NSwagOutput.cs

Here's an example of how to generate code using Swagger Codegen CLI

rapicgen swagger Swagger.json GeneratedCode ./SwaggerOutput.cs

And last but but not the least, here's an example of how to generate code using OpenAPI Generator

rapicgen openapi Swagger.json GeneratedCode ./OpenApiOutput.cs

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 ☕

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].