69a7668 Nov 12, 2018
2 contributors

Users who have contributed to this file

@wing328 @jmini
80 lines (71 sloc) 2.7 KB

Online OpenAPI generator

One can also generate API client or server using the online openapi-generator.

Here are the steps to run it locally:

mvn clean install
cd modules/openapi-generator-online
mvn spring-boot:run

💡 The online openapi-generator can be run via Docker as well.

For example, to generate Ruby API client, simply send the following HTTP request using curl:

curl -X POST -H "content-type:application/json" -d '{"openAPIUrl":""}' http://localhost:8080/api/gen/clients/ruby

Then you will receieve a JSON response with the URL to download the zipped code.

To customize the SDK, you can POST to http://localhost:8080/gen/clients/{language} with the following HTTP body:

  "options": {},
  "openAPIUrl": ""

in which the options for a language can be obtained by submitting a GET request to http://locahost:8080/api/gen/clients/{language}:

For example, curl http://localhost:8080/api/gen/clients/python returns

    "description":"python package name (convention: snake_case).",
    "description":"python package version.",
    "description":"Sort method arguments to place required parameters before optional parameters.",


To set package name to pet_store, the HTTP body of the request is as follows:

  "options": {
    "packageName": "pet_store"
  "openAPIUrl": ""

and here is the curl command:

curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"openAPIUrl": ""}' http://localhost:8080/api/gen/clients/python

Instead of using openAPIUrl with an URL to the OpenAPI spec, one can include the spec in the JSON payload with spec, e.g.

  "options": {},
  "spec": {
    "swagger": "2.0",
    "info": {
      "version": "1.0.0",
      "title": "Test API"