Skip to content

Commit 81be9cd

Browse files
authored
OCaml: derive eq (OpenAPITools#21679)
1 parent 8de694d commit 81be9cd

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type {{name}} = [
1313
| {{{camlEnumValueName}}} [@printer fun fmt _ -> Format.pp_print_string fmt "{{{name}}}"] [@name "{{{name}}}"]
1414
{{/values}}
1515
{{/allowableValues}}
16-
] [@@deriving yojson, show { with_path = false }];;
16+
] [@@deriving yojson, show { with_path = false }, eq];;
1717

1818
let {{name}}_of_yojson json = {{name}}_of_yojson (`List [json])
1919
let {{name}}_to_yojson e =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type t = {
4343
; [@key "{{{baseName}}}"]
4444
{{/isEnum}}
4545
{{/vars}}
46-
} [@@deriving yojson { strict = false }, show ];;
46+
} [@@deriving yojson { strict = false }, show, eq ];;
4747

4848
{{#description}}
4949
(** {{{.}}} *)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type t = {
2222
option [@default None]
2323

2424
; [@key "message"]
25-
} [@@deriving yojson { strict = false }, show ];;
25+
} [@@deriving yojson { strict = false }, show, eq ];;
2626

2727
(** Describes the result of uploading an image resource *)
2828
let create () : t = {

samples/client/petstore/ocaml/src/models/category.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type t = {
1717
option [@default None]
1818

1919
; [@key "name"]
20-
} [@@deriving yojson { strict = false }, show ];;
20+
} [@@deriving yojson { strict = false }, show, eq ];;
2121

2222
(** A category for a pet *)
2323
let create () : t = {

samples/client/petstore/ocaml/src/models/order.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type t = {
3939
option [@default None]
4040

4141
; [@key "complete"]
42-
} [@@deriving yojson { strict = false }, show ];;
42+
} [@@deriving yojson { strict = false }, show, eq ];;
4343

4444
(** An order for a pets from the pet store *)
4545
let create () : t = {

samples/client/petstore/ocaml/src/models/pet.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type t = {
3535
None
3636
]
3737
; [@key "status"]
38-
} [@@deriving yojson { strict = false }, show ];;
38+
} [@@deriving yojson { strict = false }, show, eq ];;
3939

4040
(** A pet for sale in the pet store *)
4141
let create (name : string) (photo_urls : string list) : t = {

samples/client/petstore/ocaml/src/models/tag.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type t = {
1717
option [@default None]
1818

1919
; [@key "name"]
20-
} [@@deriving yojson { strict = false }, show ];;
20+
} [@@deriving yojson { strict = false }, show, eq ];;
2121

2222
(** A tag for a pet *)
2323
let create () : t = {

samples/client/petstore/ocaml/src/models/user.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type t = {
4848
option [@default None]
4949

5050
; [@key "userStatus"]
51-
} [@@deriving yojson { strict = false }, show ];;
51+
} [@@deriving yojson { strict = false }, show, eq ];;
5252

5353
(** A User who is purchasing from the pet store *)
5454
let create () : t = {

samples/client/petstore/ocaml/src/support/enums.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type status = [
99
| `Placed [@printer fun fmt _ -> Format.pp_print_string fmt "placed"] [@name "placed"]
1010
| `Approved [@printer fun fmt _ -> Format.pp_print_string fmt "approved"] [@name "approved"]
1111
| `Delivered [@printer fun fmt _ -> Format.pp_print_string fmt "delivered"] [@name "delivered"]
12-
] [@@deriving yojson, show { with_path = false }];;
12+
] [@@deriving yojson, show { with_path = false }, eq];;
1313

1414
let status_of_yojson json = status_of_yojson (`List [json])
1515
let status_to_yojson e =
@@ -21,7 +21,7 @@ type pet_status = [
2121
| `Available [@printer fun fmt _ -> Format.pp_print_string fmt "available"] [@name "available"]
2222
| `Pending [@printer fun fmt _ -> Format.pp_print_string fmt "pending"] [@name "pending"]
2323
| `Sold [@printer fun fmt _ -> Format.pp_print_string fmt "sold"] [@name "sold"]
24-
] [@@deriving yojson, show { with_path = false }];;
24+
] [@@deriving yojson, show { with_path = false }, eq];;
2525

2626
let pet_status_of_yojson json = pet_status_of_yojson (`List [json])
2727
let pet_status_to_yojson e =

0 commit comments

Comments
 (0)