Julien Debon 90de8dcd75
[OCaml] Add key to each model field (#20766)
* Add key to each model field

Add a `[@key "someField"]` annotation to each model field, to avoid mismatches when the JSON field is not in snake_case.

Closes https://github.com/OpenAPITools/openapi-generator/issues/20765

* update ocaml samples

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
2025-03-04 16:49:27 +08:00

29 lines
821 B
OCaml

(*
* This file has been generated by the OCamlClientCodegen generator for openapi-generator.
*
* Generated by: https://openapi-generator.tech
*
* Schema Pet.t : A pet for sale in the pet store
*)
type t = {
id: int64 option [@default None]; [@key "id"]
category: Category.t option [@default None]; [@key "category"]
name: string; [@key "name"]
photo_urls: string list; [@key "photoUrls"]
tags: Tag.t list; [@key "tags"]
(* pet status in the store *)
status: Enums.pet_status option [@default None]; [@key "status"]
} [@@deriving yojson { strict = false }, show ];;
(** A pet for sale in the pet store *)
let create (name : string) (photo_urls : string list) : t = {
id = None;
category = None;
name = name;
photo_urls = photo_urls;
tags = [];
status = None;
}