mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-14 00:13:50 +00:00
OCaml: derive eq
(#21679)
This commit is contained in:
parent
8de694d4bb
commit
81be9cd409
@ -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 =
|
||||
|
@ -43,7 +43,7 @@ type t = {
|
||||
; [@key "{{{baseName}}}"]
|
||||
{{/isEnum}}
|
||||
{{/vars}}
|
||||
} [@@deriving yojson { strict = false }, show ];;
|
||||
} [@@deriving yojson { strict = false }, show, eq ];;
|
||||
|
||||
{{#description}}
|
||||
(** {{{.}}} *)
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user