Generating Code

SwaggerHub lets you generate server and client code based on API definitions to help you get your API servers and clients up and running quickly. You can also configure integrations to automatically push the generated code to a repository on GitHub, GitLab, Bitbucket, or Azure DevOps.

Code generation is supported for both OpenAPI 2.0 and 3.0.

Learn more

Supported languages and frameworks

The following table lists the available code generators for OpenAPI 2.0 and 3.0 definitions. Note that API editors can choose which generators will actually appear in the Export menu. SwaggerHub On-Premise also supports custom code generators.

Notes:

  • OpenAPI 3.0 generators are currently limited, but new generators are added regularly.

  • Each generator has various options, such as the dependencies to use. These options can be configured by the API editors in the codegen options for individual APIs, and will apply to all users who generate code for an API. If you want to change some options but do not have Edit permissions for an API, you can fork this API and configure the codegen options for yourself.

Name

OpenAPI 2.0

OpenAPI 3.0

Comments

Servers

C# / ASP.NET Core (aspnetcore)

C# / NancyFx (nancyfx)

C++ / Pistache (pistache-server)

SwaggerHub On-Premise note: This generator was added in v. 1.26.

C++ / Restbed (restbed)

SwaggerHub On-Premise note: This generator was added in v. 1.26.

Erlang

Go

SwaggerHub On-Premise note: Go server generator for OAS3 was added in v. 1.23.

Haskell / Servant

Java / Apache CXF (jaxrs-cxf)

SwaggerHub On-Premise note: jaxrs-cxf generator for OAS3 was added in v. 1.27.

Java / Apache CXF and CDI (jaxrs-cxf-cdi)

Java / JAX-RS using Jersey

jaxrs

jaxrs-jersey

Java / JAX-RS (jaxrs-spec)

Uses standard JAX-RS APIs, does not depend on specific JAX-RS implementations.

SwaggerHub On-Premise note: OAS3 generator was added in v. 1.27.

Java / MSF4J (msf4j)

Java / PKMST (java-pkmst)

Uses ProKarma microservices toolkit.

SwaggerHub On-Premise note: This generator was added in v. 1.27.

Java / RESTEasy (jaxrs-resteasy)

Java / RESTEasy with JBoss EAP (jaxrs-resteasy-eap)

Java / Spring (spring)

Can be Spring Boot with Springfox, Spring MVC with Springfox, or Spring Cloud Feign, depending on the codegen options.

Java / Swagger Inflector (inflector)

Java / Undertow (undertow)

Node.js

SwaggerHub On-Premise note: Node.js generator for OAS3 was added in v. 1.23.

PHP / Lumen (lumen)

PHP / Silex (php-silex)

PHP / Slim (slim)

PHP / Symfony (php-symfony)

Python / Flask

Ruby on Rails 5 (rails5)

Ruby / Sinatra (sinatra)

Rust (rust-server)

SwaggerHub On-Premise note: This generator was added in v. 1.25.0.

Scala / Akka HTTP (scala-akka-http-server)

Scala / Scalatra (scalatra)

Clients

ActionScript (flash)

Android / Java

Apex

C++ using C++ REST SDK (cpprest)

C++ / Qt 5 (qt5cpp)

C++ / Tizen (tizen)

C# / .NET 3.5 or later (csharp)

The target .NET framework version can be changed in the codegen options.

C# / .NET 2.0 using Mono compiler (csharp-dotnet2)

Clojure

Dart

Go

SwaggerHub On-Premise note: Go client generator for OAS3 was added in v. 1.26.

Groovy

Java (java)

Uses one of the following HTTP client libraries: Jersey (default), Google API Client Library for Java, OkHttp, OpenFeign, RESTEasy, Spring RestTemplate, Vert.x.

Java / JAX-RS Client API with Apache CXF (jaxrs-cxf-client)

JavaScript (javascript)

JavaScript / AngularJS (javascript-closure-angular)

AngularJS (Angular 1.x) with Google Closure Compiler annotations.

JMeter

Kotlin

Objective-C (objc)

Perl

PHP

Python

SwaggerHub On-Premise note: Python client generator for OAS3 was added in v. 1.23.

Ruby

Scala (scala)

Scala / Akka (akka-scala)

Swift 2.x (swift)

Swift 3.x (swift3)

Swift 4.x (swift4)

Swift 5.x (swift5)

SwaggerHub On-Premise note: The Swift 5.x generator for OAS2 was added in v. 1.23, and the OAS3 generator was added in v. 1.24.

TypeScript / Angular (typescript-angular)

Angular version is 4.3.0 by default, but can be changed in the codegen options.

TypeScript / AngularJS (typescript-angularjs)

Angular 1.x.

TypeScript / Fetch (typescript-fetch)

SwaggerHub On-Premise note: TypeScript / Fetch generator for OAS3 was added in v. 1.26.

TypeScript / Inversify (typescript-inversify)

TypeScript / Node.js (typescript-node)

Documentation

cwiki

Confluence wiki markup.

dynamic-html

Multiple HTML pages with left-side navigation.

html

A single print-friendly HTML page.

html2

A single HTML page with left-side navigation and tabbed code examples.

Swagger Codegen versions

Code generation is powered by the open-source Swagger Codegen project. The following table lists the Codegen versions used. You can also find the currently used Codegen version in the .swagger-codegen\VERSION file in the generated code.

SwaggerHub version

Codegen version for...

OpenAPI 2.0

OpenAPI 3.0

SwaggerHub SaaS

2.4.26

3.0.33

SwaggerHub On-Premise 2.1.0

2.4.27

3.0.34

SwaggerHub On-Premise 2.0.x

2.4.25

3.0.31

SwaggerHub On-Premise 1.29.x

2.4.21

3.0.27

SwaggerHub On-Premise 1.27.0—1.28.0

2.4.19

3.0.25

SwaggerHub On-Premise 1.26.0

2.4.17

3.0.23

SwaggerHub On-Premise 1.24.0—1.25.1

2.4.13

3.0.19

SwaggerHub On-Premise 1.23.x

2.4.10

3.0.14

SwaggerHub On-Premise 1.22.0

2.4.8

3.0.11

SwaggerHub On-Premise 1.21.0

2.4.7

3.0.10

SwaggerHub On-Premise 1.20.x

2.4.5

3.0.8

SwaggerHub On-Premise 1.19.3

2.4.2

3.0.5

SwaggerHub On-Premise 1.19.2

2.4.0

3.0.3

SwaggerHub On-Premise 1.18.8—1.19.1

2.3.1

3.0.2

SwaggerHub On-Premise 1.18.7 and earlier

2.3.1

Publication date: