Skip to content

Commit 20c86dc

Browse files
committed
[OCaml] Generate .ocamlformat file
Fixes #21806
1 parent dc8fac2 commit 20c86dc

17 files changed

Lines changed: 27 additions & 8 deletions

File tree

.github/workflows/samples-ocaml.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ jobs:
3535
- name: Build
3636
run: opam exec -- dune build
3737
working-directory: ${{ matrix.sample }}
38+
- name: Check formatting
39+
run: opam exec -- dune fmt
40+
working-directory: ${{ matrix.sample }}

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public OCamlClientCodegen() {
134134
supportingFiles.add(new SupportingFile("dune.mustache", "", "dune"));
135135
supportingFiles.add(new SupportingFile("dune-project.mustache", "", "dune-project"));
136136
supportingFiles.add(new SupportingFile("readme.mustache", "", "README.md"));
137+
supportingFiles.add(new SupportingFile("ocamlformat.mustache", "", ".ocamlformat"));
137138

138139
defaultIncludes = new HashSet<>(
139140
Arrays.asList(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
(lang dune 1.10)
2-
(name {{{packageName}}})
1+
(lang dune 2.0)
2+
(name {{{packageName}}})

modules/openapi-generator/src/main/resources/ocaml/lib.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dev-repo: ""
1414
depends: [
1515
"ocaml"
1616
"ocamlfind"
17+
"ocamlformat" {= "0.27.0"}
1718
"dune"
1819
"ppx_deriving_yojson"
1920
"conf-libev"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=0.27.0
2+
ocaml-version=4.14.0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=0.27.0
2+
ocaml-version=4.14.0

samples/client/petstore/ocaml-fake-petstore/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.ocamlformat
12
README.md
23
dune
34
dune-project
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
(lang dune 1.10)
2-
(name petstore_client)
1+
(lang dune 2.0)
2+
(name petstore_client)

samples/client/petstore/ocaml-fake-petstore/petstore_client.opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dev-repo: ""
1414
depends: [
1515
"ocaml"
1616
"ocamlfind"
17+
"ocamlformat" {= "0.27.0"}
1718
"dune"
1819
"ppx_deriving_yojson"
1920
"conf-libev"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=0.27.0
2+
ocaml-version=4.14.0

0 commit comments

Comments
 (0)