OCaml: derive eq (#21679)

This commit is contained in:
Julien Debon 2025-08-02 06:32:44 +02:00 committed by GitHub
parent 8de694d4bb
commit 81be9cd409
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 10 additions and 10 deletions

View File

@ -13,7 +13,7 @@ type {{name}} = [
| {{{camlEnumValueName}}} [@printer fun fmt _ -> Format.pp_print_string fmt "{{{name}}}"] [@name "{{{name}}}"]
{{/values}}
{{/allowableValues}}
] [@@deriving yojson, show { with_path = false }];;
] [@@deriving yojson, show { with_path = false }, eq];;
let {{name}}_of_yojson json = {{name}}_of_yojson (`List [json])
let {{name}}_to_yojson e =

View File

@ -43,7 +43,7 @@ type t = {
; [@key "{{{baseName}}}"]
{{/isEnum}}
{{/vars}}
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
{{#description}}
(** {{{.}}} *)

View File

@ -22,7 +22,7 @@ type t = {
option [@default None]
; [@key "message"]
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
(** Describes the result of uploading an image resource *)
let create () : t = {

View File

@ -17,7 +17,7 @@ type t = {
option [@default None]
; [@key "name"]
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
(** A category for a pet *)
let create () : t = {

View File

@ -39,7 +39,7 @@ type t = {
option [@default None]
; [@key "complete"]
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
(** An order for a pets from the pet store *)
let create () : t = {

View File

@ -35,7 +35,7 @@ type t = {
None
]
; [@key "status"]
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
(** A pet for sale in the pet store *)
let create (name : string) (photo_urls : string list) : t = {

View File

@ -17,7 +17,7 @@ type t = {
option [@default None]
; [@key "name"]
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
(** A tag for a pet *)
let create () : t = {

View File

@ -48,7 +48,7 @@ type t = {
option [@default None]
; [@key "userStatus"]
} [@@deriving yojson { strict = false }, show ];;
} [@@deriving yojson { strict = false }, show, eq ];;
(** A User who is purchasing from the pet store *)
let create () : t = {

View File

@ -9,7 +9,7 @@ type status = [
| `Placed [@printer fun fmt _ -> Format.pp_print_string fmt "placed"] [@name "placed"]
| `Approved [@printer fun fmt _ -> Format.pp_print_string fmt "approved"] [@name "approved"]
| `Delivered [@printer fun fmt _ -> Format.pp_print_string fmt "delivered"] [@name "delivered"]
] [@@deriving yojson, show { with_path = false }];;
] [@@deriving yojson, show { with_path = false }, eq];;
let status_of_yojson json = status_of_yojson (`List [json])
let status_to_yojson e =
@ -21,7 +21,7 @@ type pet_status = [
| `Available [@printer fun fmt _ -> Format.pp_print_string fmt "available"] [@name "available"]
| `Pending [@printer fun fmt _ -> Format.pp_print_string fmt "pending"] [@name "pending"]
| `Sold [@printer fun fmt _ -> Format.pp_print_string fmt "sold"] [@name "sold"]
] [@@deriving yojson, show { with_path = false }];;
] [@@deriving yojson, show { with_path = false }, eq];;
let pet_status_of_yojson json = pet_status_of_yojson (`List [json])
let pet_status_to_yojson e =