:star::star::star: If you would like to contribute, please refer to guidelines and a list of open tasks.:star::star::star:
:notebook_with_decorative_cover: For more information, please refer to the Wiki page and FAQ :notebook_with_decorative_cover:
:warning: If the OpenAPI/Swagger spec is obtained from an untrusted source, please make sure you've reviewed the spec before using Swagger Codegen to generate the API client, server stub or documentation as code injection may occur :warning:
:rocket: ProductHunt: https://producthunt.com/posts/swagger-codegen :rocket:
:notebook_with_decorative_cover: The eBook A Beginner's Guide to Code Generation for REST APIs is a good starting point for beginners.
Versioning
NOTE: version 2.X (io.swagger
) and 3.X (io.swagger.codegen.v3
) have different group ids.
2.X and 3.X version lines of Swagger Codegen are available; 2.X (master
branch) supports Swagger/OpenAPI version 2,
while 3.X (3.0.0
branch) supports OpenAPI version 3 (and version 2 via spec conversion to version 3).
Online generator of version 3.X supports both generation from Swagger/OpenAPI version 2 (by using engine + generators of 2.X) and version 3 specifications.
NOTE: this document refers to version 2.X, check here for 3.X.
Swagger Codegen 2.X (master
branch)
Swagger Codegen 2.X supports Swagger/OpenAPI version 2.
group id: io.swagger
maven central (maven plugin): https://mvnrepository.com/artifact/io.swagger/swagger-codegen-maven-plugin
dependency example:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.43</version>
</dependency>
Swagger Codegen 3.X (3.0.0
branch)
Swagger Codegen 3.X supports OpenAPI version 3 (and version 2 via spec conversion to version 3) Online generator of version 3.X supports both generation from Swagger/OpenAPI version 2 (by using engine + generators of 2.X) and version 3 specifications.
group id: io.swagger.codegen.v3
maven central: https://mvnrepository.com/artifact/io.swagger.codegen.v3
dependency example:
<dependency>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.61</version>
</dependency>
Overview
This is the Swagger Codegen project, which allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an OpenAPI Spec. Currently, the following languages/frameworks are supported:
- API clients: ActionScript, Ada, Apex, Bash, C# (.net 2.0, 3.5 or later), C++ (cpprest, Qt5, Tizen), Clojure, Dart, Elixir, Elm, Eiffel, Erlang, Go, Groovy, Haskell (http-client, Servant), Java (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured), Kotlin, Lua, Node.js (ES5, ES6, AngularJS with Google Closure Compiler annotations) Objective-C, Perl, PHP, PowerShell, Python, R, Ruby, Rust (rust, rust-server), Scala (akka, http4s, swagger-async-httpclient), Swift (2.x, 3.x, 4.x, 5.x), Typescript (Angular1.x, Angular2.x, Fetch, jQuery, Node)
- Server stubs: Ada, C# (ASP.NET Core, NancyFx), C++ (Pistache, Restbed), Erlang, Go, Haskell (Servant), Java (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, PKMST), Kotlin, PHP (Lumen, Slim, Silex, Symfony, Zend Expressive), Python (Flask), NodeJS, Ruby (Sinatra, Rails5), Rust (rust-server), Scala (Finch, Lagom, Scalatra)
- API documentation generators: HTML, Confluence Wiki
- Configuration files: Apache2
- Others: JMeter
Check out OpenAPI-Spec for additional information about the OpenAPI project.
Table of contents
- Versioning
- Overview
- Table of Contents
- Installation
- Getting Started
- Generators
- To generate a sample client library
- Generating libraries from your server
- Modifying the client library format
- Making your own codegen modules
- Where is Javascript???
- Generating a client from local files
- Customizing the generator
- Validating your OpenAPI Spec
- Generating dynamic html api documentation
- Generating static html api documentation
- To build a server stub
- To build the codegen library
- Workflow Integration
- Github Integration
- Online Generators
- Guidelines for Contribution
- Companies/Projects using Swagger Codegen
- Presentations/Videos/Tutorials/Books
- Swagger Codegen Core Team
- Swagger Codegen Technical Committee
- License
Compatibility
The OpenAPI Specification has undergone 3 revisions since initial creation in 2010. The Swagger Codegen project has the following compatibilities with the OpenAPI Specification:
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes |
---|---|---|---|
3.0.62-SNAPSHOT (current 3.0.0, upcoming minor release) SNAPSHOT | TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release |
3.0.61 (current stable) | 2024-08-09 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.61 |
3.0.60 | 2024-08-01 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.60 |
3.0.59 | 2024-07-22 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.59 |
3.0.58 | 2024-07-08 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.58 |
3.0.57 | 2024-05-27 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.57 |
3.0.56 | 2024-05-10 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.56 |
3.0.55 | 2024-04-22 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.55 |
3.0.54 | 2024-02-19 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.54 |
3.0.53 | 2024-02-14 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.53 |
3.0.52 | 2023-12-30 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.52 |
3.0.51 | 2023-11-21 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.51 |
3.0.50 | 2023-10-26 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.50 |
3.0.49 | 2023-10-23 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.49 |
3.0.48 | 2023-10-19 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.48 |
3.0.47 | 2023-10-02 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.47 |
3.0.46 | 2023-06-07 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.46 |
3.0.45 | 2023-06-02 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.45 |
3.0.44 | 2023-05-23 | 1.0, 1.1, 1.2, 2.0, 3.0 | tag v3.0.44 |
3.0.43 | 2023-05-17 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag |