Skip to content

Commit 4020297

Browse files
committed
[OCaml] Change field comment to Odoc, move it after the field
As per Odoc documentation, record field documentation should be *after* the field, not before. See https://ocaml.github.io/odoc/odoc/odoc_for_authors.html#special_comments type `my_record`
1 parent 10890a9 commit 4020297

54 files changed

Lines changed: 133 additions & 133 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/openapi-generator/src/main/resources/ocaml/model-record.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
type t = {
22
{{#vars}}
3-
{{#description}}
4-
(* {{{.}}} *)
5-
{{/description}}
63
{{#isEnum}}
74
{{{name}}}: {{^isMap}}Enums.{{/isMap}}{{{datatypeWithEnum}}}
85
{{^isContainer}}
@@ -31,6 +28,9 @@ type t = {
3128
{{#isMap}}{{^required}} [@default []]{{/required}} [@to_yojson JsonSupport.of_map_of [%to_yojson: {{{items.datatypeWithEnum}}}]] [@of_yojson JsonSupport.to_map_of [%of_yojson: {{{items.datatypeWithEnum}}}]]{{/isMap}}
3229
; [@key "{{{baseName}}}"]
3330
{{/isEnum}}
31+
{{#description}}
32+
(** {{{.}}} *)
33+
{{/description}}
3434
{{/vars}}
3535
} [@@deriving yojson { strict = false }, show, eq ];;
3636

samples/client/petstore/ocaml-additional-properties/src/models/some_object.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@
99

1010

1111
type t = {
12-
(* Required, free-form *)
1312
required_field1: (string * Yojson.Safe.t) list
1413

1514
[@to_yojson JsonSupport.of_map_of [%to_yojson: Yojson.Safe.t]] [@of_yojson JsonSupport.to_map_of [%of_yojson: Yojson.Safe.t]]
1615
; [@key "required_field1"]
17-
(* Required, dictionary of strings *)
18-
required_field2: (string * string) list
16+
(** Required, free-form *)
17+
required_field2: (string * string) list
1918

2019
[@to_yojson JsonSupport.of_map_of [%to_yojson: string]] [@of_yojson JsonSupport.to_map_of [%of_yojson: string]]
2120
; [@key "required_field2"]
22-
(* Required, dictionary of objects *)
23-
required_field3: (string * Some_object_required_field3_value.t) list
21+
(** Required, dictionary of strings *)
22+
required_field3: (string * Some_object_required_field3_value.t) list
2423

2524
[@to_yojson JsonSupport.of_map_of [%to_yojson: Some_object_required_field3_value.t]] [@of_yojson JsonSupport.to_map_of [%of_yojson: Some_object_required_field3_value.t]]
2625
; [@key "required_field3"]
27-
(* Optional, free-form *)
28-
optional_field1: (string * Yojson.Safe.t) list
26+
(** Required, dictionary of objects *)
27+
optional_field1: (string * Yojson.Safe.t) list
2928

3029
[@default []] [@to_yojson JsonSupport.of_map_of [%to_yojson: Yojson.Safe.t]] [@of_yojson JsonSupport.to_map_of [%of_yojson: Yojson.Safe.t]]
3130
; [@key "optional_field1"]
32-
(* Optional, dictionary of strings *)
33-
optional_field2: (string * string) list
31+
(** Optional, free-form *)
32+
optional_field2: (string * string) list
3433

3534
[@default []] [@to_yojson JsonSupport.of_map_of [%to_yojson: string]] [@of_yojson JsonSupport.to_map_of [%of_yojson: string]]
3635
; [@key "optional_field2"]
37-
(* Optional, dictionary of objects *)
38-
optional_field3: (string * Some_object_required_field3_value.t) list
36+
(** Optional, dictionary of strings *)
37+
optional_field3: (string * Some_object_required_field3_value.t) list
3938

4039
[@default []] [@to_yojson JsonSupport.of_map_of [%to_yojson: Some_object_required_field3_value.t]] [@of_yojson JsonSupport.to_map_of [%of_yojson: Some_object_required_field3_value.t]]
4140
; [@key "optional_field3"]
41+
(** Optional, dictionary of objects *)
4242
} [@@deriving yojson { strict = false }, show, eq ];;
4343

4444
let create (required_field1 : (string * Yojson.Safe.t) list) (required_field2 : (string * string) list) (required_field3 : (string * Some_object_required_field3_value.t) list) : t = {

samples/client/petstore/ocaml-additional-properties/src/models/some_object_required_field3_value.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
type t = {
12-
sub_field1: float
12+
sub_field1: float
1313

1414
option [@default None]
1515

@@ -21,7 +21,7 @@
2121

2222

2323
; [@key "sub_field2"]
24-
} [@@deriving yojson { strict = false }, show, eq ];;
24+
} [@@deriving yojson { strict = false }, show, eq ];;
2525

2626
let create () : t = {
2727
sub_field1 = None;

samples/client/petstore/ocaml-fake-petstore/src/models/additional_properties_class.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010

1111
type t = {
12-
map_property: (string * string) list
12+
map_property: (string * string) list
1313

1414
[@default []] [@to_yojson JsonSupport.of_map_of [%to_yojson: string]] [@of_yojson JsonSupport.to_map_of [%of_yojson: string]]
1515
; [@key "map_property"]
1616
map_of_map_property: (string * (string * string) list) list
1717

1818
[@default []] [@to_yojson JsonSupport.of_map_of [%to_yojson: (string * string) list]] [@of_yojson JsonSupport.to_map_of [%of_yojson: (string * string) list]]
1919
; [@key "map_of_map_property"]
20-
} [@@deriving yojson { strict = false }, show, eq ];;
20+
} [@@deriving yojson { strict = false }, show, eq ];;
2121

2222
let create () : t = {
2323
map_property = [];

samples/client/petstore/ocaml-fake-petstore/src/models/all_of_with_single_ref.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
type t = {
12-
username: string
12+
username: string
1313

1414
option [@default None]
1515

@@ -21,7 +21,7 @@
2121

2222

2323
; [@key "SingleRefType"]
24-
} [@@deriving yojson { strict = false }, show, eq ];;
24+
} [@@deriving yojson { strict = false }, show, eq ];;
2525

2626
let create () : t = {
2727
username = None;

samples/client/petstore/ocaml-fake-petstore/src/models/animal.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
type t = {
12-
class_name: string
12+
class_name: string
1313

1414

1515

@@ -21,7 +21,7 @@
2121

2222

2323
; [@key "color"]
24-
} [@@deriving yojson { strict = false }, show, eq ];;
24+
} [@@deriving yojson { strict = false }, show, eq ];;
2525

2626
let create (class_name : string) : t = {
2727
class_name = class_name;

samples/client/petstore/ocaml-fake-petstore/src/models/api_response.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
type t = {
12-
code: int32
12+
code: int32
1313

1414
option [@default None]
1515

@@ -27,7 +27,7 @@
2727

2828

2929
; [@key "message"]
30-
} [@@deriving yojson { strict = false }, show, eq ];;
30+
} [@@deriving yojson { strict = false }, show, eq ];;
3131

3232
let create () : t = {
3333
code = None;

samples/client/petstore/ocaml-fake-petstore/src/models/array_of_array_of_number_only.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010

1111
type t = {
12-
array_array_number: float list list
12+
array_array_number: float list list
1313
[@default []]
1414

1515
; [@key "ArrayArrayNumber"]
16-
} [@@deriving yojson { strict = false }, show, eq ];;
16+
} [@@deriving yojson { strict = false }, show, eq ];;
1717

1818
let create () : t = {
1919
array_array_number = [];

samples/client/petstore/ocaml-fake-petstore/src/models/array_of_number_only.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010

1111
type t = {
12-
array_number: float list
12+
array_number: float list
1313
[@default []]
1414

1515
; [@key "ArrayNumber"]
16-
} [@@deriving yojson { strict = false }, show, eq ];;
16+
} [@@deriving yojson { strict = false }, show, eq ];;
1717

1818
let create () : t = {
1919
array_number = [];

samples/client/petstore/ocaml-fake-petstore/src/models/array_test.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
type t = {
12-
array_of_string: string list
12+
array_of_string: string list
1313
[@default []]
1414

1515
; [@key "array_of_string"]
@@ -21,7 +21,7 @@
2121
[@default []]
2222

2323
; [@key "array_array_of_model"]
24-
} [@@deriving yojson { strict = false }, show, eq ];;
24+
} [@@deriving yojson { strict = false }, show, eq ];;
2525

2626
let create () : t = {
2727
array_of_string = [];

0 commit comments

Comments
 (0)