# OpenAPI Generator now supports OCaml client generator

**URL:** <https://discuss.ocaml.org/t/openapi-generator-now-supports-ocaml-client-generator/4171>\
**Category:** Learning\
**Created:** [July 29, 2019, 6:24am UTC](https://discuss.ocaml.org/t/openapi-generator-now-supports-ocaml-client-generator/4171 "2019-07-29T06:24:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wing328](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/wing328/32/1714_2.png) [@wing328](https://discuss.ocaml.org/u/wing328)\
**Post date:** [July 29, 2019, 6:24am UTC](https://discuss.ocaml.org/t/openapi-generator-now-supports-ocaml-client-generator/4171/1 "2019-07-29T06:24:37Z")

</div>

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](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](https://github.com/OpenAPITools/openapi-generator/pull/3446)).

---

<div class="post-metadata">

**Author:** ![Leonidas](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/leonidas/32/4039_2.png) [@Leonidas](https://discuss.ocaml.org/u/Leonidas)\
**Post date:** [July 30, 2019, 10:40am UTC](https://discuss.ocaml.org/t/openapi-generator-now-supports-ocaml-client-generator/4171/2 "2019-07-30T10:40:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wing328](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/wing328/32/1714_2.png) [@wing328](https://discuss.ocaml.org/u/wing328)\
**Post date:** [July 30, 2019, 2:01pm UTC](https://discuss.ocaml.org/t/openapi-generator-now-supports-ocaml-client-generator/4171/3 "2019-07-30T14:01:08Z")

</div>

According to [[OCaml] new client generator by cgensoul · Pull Request #3446 · OpenAPITools/openapi-generator · GitHub](https://github.com/OpenAPITools/openapi-generator/pull/3446#issue-300812029),

> 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](https://github.com/OpenAPITools/openapi-generator/issues/new) to track

---

<div class="post-metadata">

**Author:** ![wing328](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/wing328/32/1714_2.png) [@wing328](https://discuss.ocaml.org/u/wing328)\
**Post date:** [August 13, 2019, 6:45am UTC](https://discuss.ocaml.org/t/openapi-generator-now-supports-ocaml-client-generator/4171/4 "2019-08-13T06:45:57Z")

</div>

UPDATE: The new OCaml client generator has been included in the OpenAPI Generator v4.1.0 release: [https://twitter.com/oas\_generator/status/1160000504455319553](https://twitter.com/oas_generator/status/1160000504455319553)
