OpenAPI Generator now supports OCaml client generator

We’ve added the OCaml client generator to the OpenAPI Generator project. To generate an OCaml client given an OpenAPI/Swagger specification file, please follow 3 simple steps below:

  1. Download the Java JAR https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.0-SNAPSHOT/openapi-generator-cli-4.1.0-20190729.024538-72.jar
  2. Rename the JAR as “openapi-generator-cli.jar”
  3. Run the following command to generate an OCaml API client for the Petstore API:

Mac/Linux:

  • java -jar openapi-generator-cli.jar generate -g ocaml -i https:// raw.githubusercontent .com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o /var/tmp/ocaml

(please remove spaces in the URL as I can only share 2 URLs in a new post)

Windows:

  • java -jar openapi-generator-cli.jar generate -g ocaml -i https:// raw.githubusercontent .com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o C:\tmp\ocaml

(please remove spaces in the URL as I can only share 2 URLs in a new post)

If you’ve any feedback or question, please let us know by opening an issue in the Github repo.

Thanks Christophe Gensoul for contributing the new generator (https://github.com/OpenAPITools/openapi-generator/pull/3446).

8 Likes

Is there a plan for adding Async support or will it stay Lwt-only?

According to [OCaml] new client generator by cgensoul · Pull Request #3446 · OpenAPITools/openapi-generator · GitHub,

cohttp as the http client lib using the lwt_unix backend (lwt is a future lib for OCaml, a competing future lib is Async which Cohttp supports as well but this generator only target the lwt implementation for now)

I would suggest you open a feature request via Sign in to GitHub · GitHub to track

UPDATE: The new OCaml client generator has been included in the OpenAPI Generator v4.1.0 release: https://twitter.com/oas_generator/status/1160000504455319553

1 Like