diff --git a/README.md b/README.md index b30b6dd987c5..31532e1a4c88 100644 --- a/README.md +++ b/README.md @@ -1264,7 +1264,7 @@ If you want to join the committee, please kindly apply by sending an email to te | Nim | | | NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) | | ObjC | | -| OCaml | @cgensoul (2019/08) | +| OCaml | @cgensoul (2019/08), @sir4ur0n (2025/08) | | Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) | | PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), [@ybelenko](https://github.com/ybelenko) (2018/07), @renepardon (2018/12) | | PowerShell | @wing328 (2020/05) | diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java index b3942140dd53..1f7d6548e508 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java @@ -134,6 +134,7 @@ public OCamlClientCodegen() { supportingFiles.add(new SupportingFile("dune.mustache", "", "dune")); supportingFiles.add(new SupportingFile("dune-project.mustache", "", "dune-project")); supportingFiles.add(new SupportingFile("readme.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("ocamlformat.mustache", "", ".ocamlformat")); defaultIncludes = new HashSet<>( Arrays.asList( diff --git a/modules/openapi-generator/src/main/resources/ocaml/dune-project.mustache b/modules/openapi-generator/src/main/resources/ocaml/dune-project.mustache index 8e48d839f686..a90e8a118ef8 100644 --- a/modules/openapi-generator/src/main/resources/ocaml/dune-project.mustache +++ b/modules/openapi-generator/src/main/resources/ocaml/dune-project.mustache @@ -1,2 +1,2 @@ -(lang dune 1.10) -(name {{{packageName}}}) \ No newline at end of file +(lang dune 2.0) +(name {{{packageName}}}) diff --git a/modules/openapi-generator/src/main/resources/ocaml/lib.mustache b/modules/openapi-generator/src/main/resources/ocaml/lib.mustache index 017bf839c431..8a52b64c4cdf 100644 --- a/modules/openapi-generator/src/main/resources/ocaml/lib.mustache +++ b/modules/openapi-generator/src/main/resources/ocaml/lib.mustache @@ -14,6 +14,7 @@ dev-repo: "" depends: [ "ocaml" "ocamlfind" + "ocamlformat" {= "0.27.0"} "dune" "ppx_deriving_yojson" "conf-libev" diff --git a/modules/openapi-generator/src/main/resources/ocaml/ocamlformat.mustache b/modules/openapi-generator/src/main/resources/ocaml/ocamlformat.mustache new file mode 100644 index 000000000000..402c7252e5f9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ocaml/ocamlformat.mustache @@ -0,0 +1,2 @@ +version=0.27.0 +ocaml-version=4.14.0 diff --git a/samples/client/petstore/ocaml-fake-petstore/.ocamlformat b/samples/client/petstore/ocaml-fake-petstore/.ocamlformat new file mode 100644 index 000000000000..402c7252e5f9 --- /dev/null +++ b/samples/client/petstore/ocaml-fake-petstore/.ocamlformat @@ -0,0 +1,2 @@ +version=0.27.0 +ocaml-version=4.14.0 diff --git a/samples/client/petstore/ocaml-fake-petstore/.openapi-generator/FILES b/samples/client/petstore/ocaml-fake-petstore/.openapi-generator/FILES index d4a1e97f7ede..2e12d2aabc0d 100644 --- a/samples/client/petstore/ocaml-fake-petstore/.openapi-generator/FILES +++ b/samples/client/petstore/ocaml-fake-petstore/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.ocamlformat README.md dune dune-project diff --git a/samples/client/petstore/ocaml-fake-petstore/dune-project b/samples/client/petstore/ocaml-fake-petstore/dune-project index 79d86e3c901a..60a6d76962b7 100644 --- a/samples/client/petstore/ocaml-fake-petstore/dune-project +++ b/samples/client/petstore/ocaml-fake-petstore/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) -(name petstore_client) \ No newline at end of file +(lang dune 2.0) +(name petstore_client) diff --git a/samples/client/petstore/ocaml-fake-petstore/petstore_client.opam b/samples/client/petstore/ocaml-fake-petstore/petstore_client.opam index 7ca31fc5af4f..d7c41adb6a11 100644 --- a/samples/client/petstore/ocaml-fake-petstore/petstore_client.opam +++ b/samples/client/petstore/ocaml-fake-petstore/petstore_client.opam @@ -14,6 +14,7 @@ dev-repo: "" depends: [ "ocaml" "ocamlfind" + "ocamlformat" {= "0.27.0"} "dune" "ppx_deriving_yojson" "conf-libev" diff --git a/samples/client/petstore/ocaml-oneOf/.ocamlformat b/samples/client/petstore/ocaml-oneOf/.ocamlformat new file mode 100644 index 000000000000..402c7252e5f9 --- /dev/null +++ b/samples/client/petstore/ocaml-oneOf/.ocamlformat @@ -0,0 +1,2 @@ +version=0.27.0 +ocaml-version=4.14.0 diff --git a/samples/client/petstore/ocaml-oneOf/.openapi-generator/FILES b/samples/client/petstore/ocaml-oneOf/.openapi-generator/FILES index 0623f326da70..d128ebea197a 100644 --- a/samples/client/petstore/ocaml-oneOf/.openapi-generator/FILES +++ b/samples/client/petstore/ocaml-oneOf/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.ocamlformat README.md dune dune-project diff --git a/samples/client/petstore/ocaml-oneOf/dune-project b/samples/client/petstore/ocaml-oneOf/dune-project index 79d86e3c901a..60a6d76962b7 100644 --- a/samples/client/petstore/ocaml-oneOf/dune-project +++ b/samples/client/petstore/ocaml-oneOf/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) -(name petstore_client) \ No newline at end of file +(lang dune 2.0) +(name petstore_client) diff --git a/samples/client/petstore/ocaml-oneOf/petstore_client.opam b/samples/client/petstore/ocaml-oneOf/petstore_client.opam index 7ca31fc5af4f..d7c41adb6a11 100644 --- a/samples/client/petstore/ocaml-oneOf/petstore_client.opam +++ b/samples/client/petstore/ocaml-oneOf/petstore_client.opam @@ -14,6 +14,7 @@ dev-repo: "" depends: [ "ocaml" "ocamlfind" + "ocamlformat" {= "0.27.0"} "dune" "ppx_deriving_yojson" "conf-libev" diff --git a/samples/client/petstore/ocaml/.ocamlformat b/samples/client/petstore/ocaml/.ocamlformat new file mode 100644 index 000000000000..402c7252e5f9 --- /dev/null +++ b/samples/client/petstore/ocaml/.ocamlformat @@ -0,0 +1,2 @@ +version=0.27.0 +ocaml-version=4.14.0 diff --git a/samples/client/petstore/ocaml/.openapi-generator/FILES b/samples/client/petstore/ocaml/.openapi-generator/FILES index 8d7df53d9a09..57c9951ea626 100644 --- a/samples/client/petstore/ocaml/.openapi-generator/FILES +++ b/samples/client/petstore/ocaml/.openapi-generator/FILES @@ -1,3 +1,4 @@ +.ocamlformat README.md dune dune-project diff --git a/samples/client/petstore/ocaml/dune-project b/samples/client/petstore/ocaml/dune-project index 79d86e3c901a..60a6d76962b7 100644 --- a/samples/client/petstore/ocaml/dune-project +++ b/samples/client/petstore/ocaml/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) -(name petstore_client) \ No newline at end of file +(lang dune 2.0) +(name petstore_client) diff --git a/samples/client/petstore/ocaml/petstore_client.opam b/samples/client/petstore/ocaml/petstore_client.opam index 7ca31fc5af4f..d7c41adb6a11 100644 --- a/samples/client/petstore/ocaml/petstore_client.opam +++ b/samples/client/petstore/ocaml/petstore_client.opam @@ -14,6 +14,7 @@ dev-repo: "" depends: [ "ocaml" "ocamlfind" + "ocamlformat" {= "0.27.0"} "dune" "ppx_deriving_yojson" "conf-libev" diff --git a/samples/client/petstore/ocaml/src/models/inline_object.ml b/samples/client/petstore/ocaml/src/models/inline_object.ml index 37a44a8d6835..90970779f5a5 100644 --- a/samples/client/petstore/ocaml/src/models/inline_object.ml +++ b/samples/client/petstore/ocaml/src/models/inline_object.ml @@ -6,14 +6,11 @@ *) type t = { - (* Updated name of the pet *) - name: string option [@default None]; - (* Updated status of the pet *) - status: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - name = None; - status = None; + (* Updated name of the pet *) + name : string option; [@default None] + (* Updated status of the pet *) + status : string option; [@default None] } +[@@deriving yojson { strict = false }, show] +let create () : t = { name = None; status = None } diff --git a/samples/client/petstore/ocaml/src/models/inline_object_1.ml b/samples/client/petstore/ocaml/src/models/inline_object_1.ml index 2d453134c439..893ae9b6b989 100644 --- a/samples/client/petstore/ocaml/src/models/inline_object_1.ml +++ b/samples/client/petstore/ocaml/src/models/inline_object_1.ml @@ -6,14 +6,11 @@ *) type t = { - (* Additional data to pass to server *) - additional_metadata: string option [@default None]; - (* file to upload *) - file: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - additional_metadata = None; - file = None; + (* Additional data to pass to server *) + additional_metadata : string option; [@default None] + (* file to upload *) + file : string option; [@default None] } +[@@deriving yojson { strict = false }, show] +let create () : t = { additional_metadata = None; file = None }