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 (on this page)
Swagger Codegen Versions (on this page)
Custom Codegen Templates (SwaggerHub On-Premise only)
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 ( | ✓ | ✓ | |
C# / NancyFx ( | ✓ | ||
C++ / Pistache ( | ✓ | SwaggerHub On-Premise note: This generator was added in v. 1.26. | |
C++ / 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 ( | ✓ | ✓ | SwaggerHub On-Premise note: jaxrs-cxf generator for OAS3 was added in v. 1.27. |
Java / Apache CXF and CDI ( | ✓ | ||
Java / JAX-RS using Jersey | ✓ | ✓ | |
Java / JAX-RS ( | ✓ | ✓ | 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 ( | ✓ | ||
Java / PKMST ( | ✓ | Uses ProKarma microservices toolkit. SwaggerHub On-Premise note: This generator was added in v. 1.27. | |
Java / RESTEasy ( | ✓ | ✓ | |
Java / RESTEasy with JBoss EAP ( | ✓ | ||
Java / Spring ( | ✓ | ✓ | Can be Spring Boot with Springfox, Spring MVC with Springfox, or Spring Cloud Feign, depending on the codegen options. |
Java / Swagger Inflector ( | ✓ | ✓ | |
Java / Undertow ( | ✓ | ||
Node.js | ✓ | ✓ | SwaggerHub On-Premise note: Node.js generator for OAS3 was added in v. 1.23. |
PHP / Lumen ( | ✓ | ||
PHP / Silex ( | ✓ | ||
PHP / Slim ( | ✓ | ||
PHP / Symfony ( | ✓ | ||
Python / Flask | ✓ | ✓ | |
Ruby on Rails 5 ( | ✓ | ||
Ruby / Sinatra ( | ✓ | ||
Rust ( | ✓ | SwaggerHub On-Premise note: This generator was added in v. 1.25.0. | |
Scala / Akka HTTP ( | ✓ | ||
Scala / Scalatra ( | ✓ | ||
Clients | |||
ActionScript ( | ✓ | ||
Android / Java | ✓ | ||
Apex | ✓ | ||
C++ using C++ REST SDK ( | ✓ | ||
C++ / Qt 5 ( | ✓ | ||
C++ / Tizen ( | ✓ | ||
C# / .NET 3.5 or later ( | ✓ | ✓ | The target .NET framework version can be changed in the codegen options. |
C# / .NET 2.0 using Mono compiler ( | ✓ | ||
Clojure | ✓ | ||
Dart | ✓ | ||
Go | ✓ | ✓ | SwaggerHub On-Premise note: Go client generator for OAS3 was added in v. 1.26. |
Groovy | ✓ | ||
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 ( | ✓ | ✓ | |
JavaScript ( | ✓ | ||
JavaScript / AngularJS ( | ✓ | AngularJS (Angular 1.x) with Google Closure Compiler annotations. | |
JMeter | ✓ | ||
Kotlin | ✓ | ✓ | |
Objective-C ( | ✓ | ||
Perl | ✓ | ||
PHP | ✓ | ✓ | |
Python | ✓ | ✓ | SwaggerHub On-Premise note: Python client generator for OAS3 was added in v. 1.23. |
Ruby | ✓ | ||
Scala ( | ✓ | ✓ | |
Scala / Akka ( | ✓ | ||
Swift 2.x ( | ✓ | ||
Swift 3.x ( | ✓ | ✓ | |
Swift 4.x ( | ✓ | ✓ | |
Swift 5.x ( | ✓ | ✓ | 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 ( | ✓ | ✓ | Angular version is 4.3.0 by default, but can be changed in the codegen options. |
TypeScript / AngularJS ( | ✓ | Angular 1.x. | |
TypeScript / Fetch ( | ✓ | ✓ | SwaggerHub On-Premise note: TypeScript / Fetch generator for OAS3 was added in v. 1.26. |
TypeScript / Inversify ( | ✓ | ||
TypeScript / Node.js ( | ✓ | ||
Documentation | |||
| ✓ | Confluence wiki markup. | |
| ✓ | ✓ | Multiple HTML pages with left-side navigation. |
| ✓ | ✓ | A single print-friendly HTML page. |
| ✓ | ✓ | 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 | – |