From 202d184ce26a316ba7c88af937709a7adbcd2849 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 25 May 2020 09:09:22 +0800 Subject: [PATCH] Migrate OCaml petstore to use OAS v3 spec (#6348) * migrate ocaml petstore to use oas3 * break the build * Revert "break the build" This reverts commit a7c12d90fea50c9739ed302f3c8e94e9f437d491. --- bin/ocaml-petstore.sh | 2 +- bin/openapi3/ocaml-client-petstore.sh | 34 ----- bin/windows/ocaml-petstore.bat | 2 +- .../petstore/ocaml/.openapi-generator/VERSION | 2 +- .../client/petstore/ocaml/src/apis/pet_api.ml | 12 +- .../petstore/ocaml/src/apis/pet_api.mli | 4 +- .../petstore/ocaml/src/apis/store_api.ml | 4 +- .../petstore/ocaml/src/apis/store_api.mli | 2 +- .../petstore/ocaml/src/apis/user_api.ml | 22 ++- .../petstore/ocaml/src/apis/user_api.mli | 8 +- .../ocaml/src/models/inline_object.ml | 0 .../ocaml/src/models/inline_object_1.ml | 0 .../petstore/ocaml/.openapi-generator-ignore | 23 --- .../petstore/ocaml/.openapi-generator/VERSION | 1 - .../openapi3/client/petstore/ocaml/README.md | 27 ---- samples/openapi3/client/petstore/ocaml/dune | 9 -- .../client/petstore/ocaml/dune-project | 2 - .../petstore/ocaml/petstore_client.opam | 15 -- .../ocaml/src/apis/another_fake_api.ml | 15 -- .../ocaml/src/apis/another_fake_api.mli | 8 - .../petstore/ocaml/src/apis/default_api.ml | 14 -- .../petstore/ocaml/src/apis/default_api.mli | 8 - .../petstore/ocaml/src/apis/fake_api.ml | 143 ------------------ .../petstore/ocaml/src/apis/fake_api.mli | 20 --- .../src/apis/fake_classname_tags123_api.ml | 16 -- .../src/apis/fake_classname_tags123_api.mli | 8 - .../client/petstore/ocaml/src/apis/pet_api.ml | 93 ------------ .../petstore/ocaml/src/apis/pet_api.mli | 16 -- .../petstore/ocaml/src/apis/store_api.ml | 39 ----- .../petstore/ocaml/src/apis/store_api.mli | 11 -- .../petstore/ocaml/src/apis/user_api.ml | 72 --------- .../petstore/ocaml/src/apis/user_api.mli | 15 -- .../src/models/additional_properties_class.ml | 17 --- .../petstore/ocaml/src/models/animal.ml | 17 --- .../petstore/ocaml/src/models/api_response.ml | 19 --- .../models/array_of_array_of_number_only.ml | 15 -- .../ocaml/src/models/array_of_number_only.ml | 15 -- .../petstore/ocaml/src/models/array_test.ml | 19 --- .../ocaml/src/models/capitalization.ml | 26 ---- .../client/petstore/ocaml/src/models/cat.ml | 19 --- .../petstore/ocaml/src/models/cat_all_of.ml | 15 -- .../petstore/ocaml/src/models/category.ml | 17 --- .../petstore/ocaml/src/models/class_model.ml | 17 --- .../petstore/ocaml/src/models/client.ml | 15 -- .../client/petstore/ocaml/src/models/dog.ml | 19 --- .../petstore/ocaml/src/models/dog_all_of.ml | 15 -- .../petstore/ocaml/src/models/enum_arrays.ml | 17 --- .../petstore/ocaml/src/models/enum_test.ml | 29 ---- .../client/petstore/ocaml/src/models/file.ml | 18 --- .../src/models/file_schema_test_class.ml | 17 --- .../client/petstore/ocaml/src/models/foo.ml | 15 -- .../petstore/ocaml/src/models/format_test.ml | 45 ------ .../ocaml/src/models/has_only_read_only.ml | 17 --- .../ocaml/src/models/health_check_result.ml | 17 --- .../ocaml/src/models/inline_object_2.ml | 19 --- .../ocaml/src/models/inline_object_3.ml | 55 ------- .../ocaml/src/models/inline_object_4.ml | 19 --- .../ocaml/src/models/inline_object_5.ml | 19 --- .../src/models/inline_response_default.ml | 15 -- .../petstore/ocaml/src/models/map_test.ml | 21 --- ...perties_and_additional_properties_class.ml | 19 --- .../ocaml/src/models/model_200_response.ml | 19 --- .../src/models/model__special_model_name_.ml | 15 -- .../client/petstore/ocaml/src/models/name.ml | 23 --- .../ocaml/src/models/nullable_class.ml | 37 ----- .../petstore/ocaml/src/models/number_only.ml | 15 -- .../client/petstore/ocaml/src/models/order.ml | 26 ---- .../ocaml/src/models/outer_composite.ml | 19 --- .../client/petstore/ocaml/src/models/pet.ml | 26 ---- .../ocaml/src/models/read_only_first.ml | 17 --- .../petstore/ocaml/src/models/return.ml | 17 --- .../client/petstore/ocaml/src/models/tag.ml | 17 --- .../client/petstore/ocaml/src/models/user.ml | 30 ---- .../petstore/ocaml/src/support/enums.ml | 142 ----------------- .../petstore/ocaml/src/support/jsonSupport.ml | 55 ------- .../petstore/ocaml/src/support/request.ml | 97 ------------ 76 files changed, 32 insertions(+), 1757 deletions(-) delete mode 100755 bin/openapi3/ocaml-client-petstore.sh rename samples/{openapi3 => }/client/petstore/ocaml/src/models/inline_object.ml (100%) rename samples/{openapi3 => }/client/petstore/ocaml/src/models/inline_object_1.ml (100%) delete mode 100644 samples/openapi3/client/petstore/ocaml/.openapi-generator-ignore delete mode 100644 samples/openapi3/client/petstore/ocaml/.openapi-generator/VERSION delete mode 100644 samples/openapi3/client/petstore/ocaml/README.md delete mode 100644 samples/openapi3/client/petstore/ocaml/dune delete mode 100644 samples/openapi3/client/petstore/ocaml/dune-project delete mode 100644 samples/openapi3/client/petstore/ocaml/petstore_client.opam delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/default_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/default_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/fake_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/fake_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/pet_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/pet_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/store_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/store_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/user_api.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/apis/user_api.mli delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/additional_properties_class.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/animal.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/api_response.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/array_of_array_of_number_only.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/array_of_number_only.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/array_test.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/capitalization.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/cat.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/cat_all_of.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/category.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/class_model.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/client.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/dog.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/dog_all_of.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/enum_arrays.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/enum_test.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/file.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/file_schema_test_class.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/foo.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/format_test.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/has_only_read_only.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/health_check_result.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/inline_object_2.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/inline_object_3.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/inline_object_4.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/inline_object_5.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/inline_response_default.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/map_test.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/mixed_properties_and_additional_properties_class.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/model_200_response.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/model__special_model_name_.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/name.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/nullable_class.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/number_only.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/order.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/outer_composite.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/pet.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/read_only_first.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/return.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/tag.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/models/user.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/support/enums.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/support/jsonSupport.ml delete mode 100644 samples/openapi3/client/petstore/ocaml/src/support/request.ml diff --git a/bin/ocaml-petstore.sh b/bin/ocaml-petstore.sh index 9b3cb70990e..1018d3c005f 100755 --- a/bin/ocaml-petstore.sh +++ b/bin/ocaml-petstore.sh @@ -28,7 +28,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ocaml -o samples/client/petstore/ocaml --additional-properties packageName=petstore_client $@" +args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ocaml -o samples/client/petstore/ocaml --additional-properties packageName=petstore_client $@" echo "java ${JAVA_OPTS} -jar ${executable} ${args}" java $JAVA_OPTS -jar $executable $args diff --git a/bin/openapi3/ocaml-client-petstore.sh b/bin/openapi3/ocaml-client-petstore.sh deleted file mode 100755 index ccd51527f17..00000000000 --- a/bin/openapi3/ocaml-client-petstore.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -SCRIPT="$0" -echo "# START SCRIPT: $SCRIPT" - -while [ -h "$SCRIPT" ] ; do - ls=`ls -ld "$SCRIPT"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - SCRIPT="$link" - else - SCRIPT=`dirname "$SCRIPT"`/"$link" - fi -done - -if [ ! -d "${APP_DIR}" ]; then - APP_DIR=`dirname "$SCRIPT"`/.. - APP_DIR=`cd "${APP_DIR}"; pwd` -fi - -executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" - -if [ ! -f "$executable" ] -then - mvn -B clean package -fi - -# if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DdebugOperations -DloggerPath=conf/log4j.properties" - -args="generate -t modules/openapi-generator/src/main/resources/ocaml -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ocaml -o samples/openapi3/client/petstore/ocaml/ --additional-properties packageName=petstore_client $@" - -echo "java ${JAVA_OPTS} -jar ${executable} ${args}" -java $JAVA_OPTS -jar $executable $args diff --git a/bin/windows/ocaml-petstore.bat b/bin/windows/ocaml-petstore.bat index aa59c18b827..09c04a83016 100755 --- a/bin/windows/ocaml-petstore.bat +++ b/bin/windows/ocaml-petstore.bat @@ -5,6 +5,6 @@ If Not Exist %executable% ( ) REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties -set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g ocaml -o samples\client\petstore\ocaml +set ags=generate -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g ocaml -o samples\client\petstore\ocaml java %JAVA_OPTS% -jar %executable% %ags% diff --git a/samples/client/petstore/ocaml/.openapi-generator/VERSION b/samples/client/petstore/ocaml/.openapi-generator/VERSION index e4955748d3e..d99e7162d01 100644 --- a/samples/client/petstore/ocaml/.openapi-generator/VERSION +++ b/samples/client/petstore/ocaml/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.2-SNAPSHOT \ No newline at end of file +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/ocaml/src/apis/pet_api.ml b/samples/client/petstore/ocaml/src/apis/pet_api.ml index ec3d3674fb2..3046e5b561f 100644 --- a/samples/client/petstore/ocaml/src/apis/pet_api.ml +++ b/samples/client/petstore/ocaml/src/apis/pet_api.ml @@ -5,13 +5,13 @@ * *) -let add_pet ~body = +let add_pet ~pet_t = let open Lwt in let uri = Request.build_uri "/pet" in let headers = Request.default_headers in - let body = Request.write_as_json_body Pet.to_yojson body in + let body = Request.write_as_json_body Pet.to_yojson pet_t in Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp + Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body let delete_pet ~pet_id ?api_key () = let open Lwt in @@ -47,13 +47,13 @@ let get_pet_by_id ~pet_id = Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body -let update_pet ~body = +let update_pet ~pet_t = let open Lwt in let uri = Request.build_uri "/pet" in let headers = Request.default_headers in - let body = Request.write_as_json_body Pet.to_yojson body in + let body = Request.write_as_json_body Pet.to_yojson pet_t in Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp + Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body let update_pet_with_form ~pet_id ?name ?status () = let open Lwt in diff --git a/samples/client/petstore/ocaml/src/apis/pet_api.mli b/samples/client/petstore/ocaml/src/apis/pet_api.mli index 301beaa2c72..c52ae12f120 100644 --- a/samples/client/petstore/ocaml/src/apis/pet_api.mli +++ b/samples/client/petstore/ocaml/src/apis/pet_api.mli @@ -5,11 +5,11 @@ * *) -val add_pet : body:Pet.t -> unit Lwt.t +val add_pet : pet_t:Pet.t -> Pet.t Lwt.t val delete_pet : pet_id:int64 -> ?api_key:string -> unit -> unit Lwt.t val find_pets_by_status : status:Enums.pet_status list -> Pet.t list Lwt.t val find_pets_by_tags : tags:string list -> Pet.t list Lwt.t val get_pet_by_id : pet_id:int64 -> Pet.t Lwt.t -val update_pet : body:Pet.t -> unit Lwt.t +val update_pet : pet_t:Pet.t -> Pet.t Lwt.t val update_pet_with_form : pet_id:int64 -> ?name:string -> ?status:string -> unit -> unit Lwt.t val upload_file : pet_id:int64 -> ?additional_metadata:string -> ?file:string -> unit -> Api_response.t Lwt.t diff --git a/samples/client/petstore/ocaml/src/apis/store_api.ml b/samples/client/petstore/ocaml/src/apis/store_api.ml index 187cbbb5188..9465fadd716 100644 --- a/samples/client/petstore/ocaml/src/apis/store_api.ml +++ b/samples/client/petstore/ocaml/src/apis/store_api.ml @@ -29,11 +29,11 @@ let get_order_by_id ~order_id = Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body -let place_order ~body = +let place_order ~order_t = let open Lwt in let uri = Request.build_uri "/store/order" in let headers = Request.default_headers in - let body = Request.write_as_json_body Order.to_yojson body in + let body = Request.write_as_json_body Order.to_yojson order_t in Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body diff --git a/samples/client/petstore/ocaml/src/apis/store_api.mli b/samples/client/petstore/ocaml/src/apis/store_api.mli index 53c81ec52c7..63b09db9ca5 100644 --- a/samples/client/petstore/ocaml/src/apis/store_api.mli +++ b/samples/client/petstore/ocaml/src/apis/store_api.mli @@ -8,4 +8,4 @@ val delete_order : order_id:string -> unit Lwt.t val get_inventory : unit -> (string * int32) list Lwt.t val get_order_by_id : order_id:int64 -> Order.t Lwt.t -val place_order : body:Order.t -> Order.t Lwt.t +val place_order : order_t:Order.t -> Order.t Lwt.t diff --git a/samples/client/petstore/ocaml/src/apis/user_api.ml b/samples/client/petstore/ocaml/src/apis/user_api.ml index 5c1027f601c..2bef35ae99f 100644 --- a/samples/client/petstore/ocaml/src/apis/user_api.ml +++ b/samples/client/petstore/ocaml/src/apis/user_api.ml @@ -5,27 +5,30 @@ * *) -let create_user ~body = +let create_user ~user_t = let open Lwt in let uri = Request.build_uri "/user" in let headers = Request.default_headers in - let body = Request.write_as_json_body User.to_yojson body in + let headers = Cohttp.Header.add headers "api_key" Request.api_key in + let body = Request.write_as_json_body User.to_yojson user_t in Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> Request.handle_unit_response resp -let create_users_with_array_input ~body = +let create_users_with_array_input ~user = let open Lwt in let uri = Request.build_uri "/user/createWithArray" in let headers = Request.default_headers in - let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) body in + let headers = Cohttp.Header.add headers "api_key" Request.api_key in + let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> Request.handle_unit_response resp -let create_users_with_list_input ~body = +let create_users_with_list_input ~user = let open Lwt in let uri = Request.build_uri "/user/createWithList" in let headers = Request.default_headers in - let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) body in + let headers = Cohttp.Header.add headers "api_key" Request.api_key in + let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> Request.handle_unit_response resp @@ -33,6 +36,7 @@ let delete_user ~username = let open Lwt in let uri = Request.build_uri "/user/{username}" in let headers = Request.default_headers in + let headers = Cohttp.Header.add headers "api_key" Request.api_key in let uri = Request.replace_path_param uri "username" (fun x -> x) username in Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> Request.handle_unit_response resp @@ -58,15 +62,17 @@ let logout_user () = let open Lwt in let uri = Request.build_uri "/user/logout" in let headers = Request.default_headers in + let headers = Cohttp.Header.add headers "api_key" Request.api_key in Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> Request.handle_unit_response resp -let update_user ~username ~body = +let update_user ~username ~user_t = let open Lwt in let uri = Request.build_uri "/user/{username}" in let headers = Request.default_headers in + let headers = Cohttp.Header.add headers "api_key" Request.api_key in let uri = Request.replace_path_param uri "username" (fun x -> x) username in - let body = Request.write_as_json_body User.to_yojson body in + let body = Request.write_as_json_body User.to_yojson user_t in Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) -> Request.handle_unit_response resp diff --git a/samples/client/petstore/ocaml/src/apis/user_api.mli b/samples/client/petstore/ocaml/src/apis/user_api.mli index 5ea7ba2471f..9a7e8e59c3a 100644 --- a/samples/client/petstore/ocaml/src/apis/user_api.mli +++ b/samples/client/petstore/ocaml/src/apis/user_api.mli @@ -5,11 +5,11 @@ * *) -val create_user : body:User.t -> unit Lwt.t -val create_users_with_array_input : body:User.t list -> unit Lwt.t -val create_users_with_list_input : body:User.t list -> unit Lwt.t +val create_user : user_t:User.t -> unit Lwt.t +val create_users_with_array_input : user:User.t list -> unit Lwt.t +val create_users_with_list_input : user:User.t list -> unit Lwt.t val delete_user : username:string -> unit Lwt.t val get_user_by_name : username:string -> User.t Lwt.t val login_user : username:string -> password:string -> string Lwt.t val logout_user : unit -> unit Lwt.t -val update_user : username:string -> body:User.t -> unit Lwt.t +val update_user : username:string -> user_t:User.t -> unit Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_object.ml b/samples/client/petstore/ocaml/src/models/inline_object.ml similarity index 100% rename from samples/openapi3/client/petstore/ocaml/src/models/inline_object.ml rename to samples/client/petstore/ocaml/src/models/inline_object.ml diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_1.ml b/samples/client/petstore/ocaml/src/models/inline_object_1.ml similarity index 100% rename from samples/openapi3/client/petstore/ocaml/src/models/inline_object_1.ml rename to samples/client/petstore/ocaml/src/models/inline_object_1.ml diff --git a/samples/openapi3/client/petstore/ocaml/.openapi-generator-ignore b/samples/openapi3/client/petstore/ocaml/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a3..00000000000 --- a/samples/openapi3/client/petstore/ocaml/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/openapi3/client/petstore/ocaml/.openapi-generator/VERSION b/samples/openapi3/client/petstore/ocaml/.openapi-generator/VERSION deleted file mode 100644 index 83a328a9227..00000000000 --- a/samples/openapi3/client/petstore/ocaml/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/ocaml/README.md b/samples/openapi3/client/petstore/ocaml/README.md deleted file mode 100644 index 0f61cbb94ec..00000000000 --- a/samples/openapi3/client/petstore/ocaml/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \'' \\ - -This OCaml package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.OCamlClientCodegen - -## Requirements. - -OCaml 4.x - -## Installation - -Please run the following commands to build the package `petstore_client`: - -```sh -opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix -eval $(opam env) -dune build -``` - -## Getting Started - -TODO - diff --git a/samples/openapi3/client/petstore/ocaml/dune b/samples/openapi3/client/petstore/ocaml/dune deleted file mode 100644 index ed1c4d90e3d..00000000000 --- a/samples/openapi3/client/petstore/ocaml/dune +++ /dev/null @@ -1,9 +0,0 @@ -(include_subdirs unqualified) -(library - (name petstore_client) - (public_name petstore_client) - (flags (:standard -w -27)) - (libraries str cohttp-lwt-unix lwt yojson ppx_deriving_yojson.runtime) - (preprocess (pps ppx_deriving_yojson ppx_deriving.std)) - (wrapped true) -) \ No newline at end of file diff --git a/samples/openapi3/client/petstore/ocaml/dune-project b/samples/openapi3/client/petstore/ocaml/dune-project deleted file mode 100644 index 79d86e3c901..00000000000 --- a/samples/openapi3/client/petstore/ocaml/dune-project +++ /dev/null @@ -1,2 +0,0 @@ -(lang dune 1.10) -(name petstore_client) \ No newline at end of file diff --git a/samples/openapi3/client/petstore/ocaml/petstore_client.opam b/samples/openapi3/client/petstore/ocaml/petstore_client.opam deleted file mode 100644 index 3c3603c2f14..00000000000 --- a/samples/openapi3/client/petstore/ocaml/petstore_client.opam +++ /dev/null @@ -1,15 +0,0 @@ -opam-version: "2.0" -name: "petstore_client" -version: "1.0.0" -synopsis: "" -description: """ -Longer description -""" -maintainer: "Name " -authors: "Name " -license: "" -homepage: "" -bug-reports: "" -dev-repo: "" -depends: [ "ocaml" "ocamlfind" ] -build: ["dune" "build" "-p" name] \ No newline at end of file diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.ml deleted file mode 100644 index c147d4d0579..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let call_123_test_special_tags ~client_t = - let open Lwt in - let uri = Request.build_uri "/another-fake/dummy" in - let headers = Request.default_headers in - let body = Request.write_as_json_body Client.to_yojson client_t in - Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Client.of_yojson) resp body - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.mli deleted file mode 100644 index 3e9e0c80484..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/another_fake_api.mli +++ /dev/null @@ -1,8 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val call_123_test_special_tags : client_t:Client.t -> Client.t Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/default_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/default_api.ml deleted file mode 100644 index f220c4ba598..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/default_api.ml +++ /dev/null @@ -1,14 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let foo_get () = - let open Lwt in - let uri = Request.build_uri "/foo" in - let headers = Request.default_headers in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Inline_response_default.of_yojson) resp body - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/default_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/default_api.mli deleted file mode 100644 index f1392d7621c..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/default_api.mli +++ /dev/null @@ -1,8 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val foo_get : unit -> Inline_response_default.t Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/fake_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/fake_api.ml deleted file mode 100644 index e9fce6261b9..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/fake_api.ml +++ /dev/null @@ -1,143 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let fake_health_get () = - let open Lwt in - let uri = Request.build_uri "/fake/health" in - let headers = Request.default_headers in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Health_check_result.of_yojson) resp body - -let fake_outer_boolean_serialize ~body () = - let open Lwt in - let uri = Request.build_uri "/fake/outer/boolean" in - let headers = Request.default_headers in - let body = Request.write_as_json_body JsonSupport.of_bool body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.to_bool) resp body - -let fake_outer_composite_serialize ~outer_composite_t () = - let open Lwt in - let uri = Request.build_uri "/fake/outer/composite" in - let headers = Request.default_headers in - let body = Request.write_as_json_body Outer_composite.to_yojson outer_composite_t in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Outer_composite.of_yojson) resp body - -let fake_outer_number_serialize ~body () = - let open Lwt in - let uri = Request.build_uri "/fake/outer/number" in - let headers = Request.default_headers in - let body = Request.write_as_json_body JsonSupport.of_float body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.to_float) resp body - -let fake_outer_string_serialize ~body () = - let open Lwt in - let uri = Request.build_uri "/fake/outer/string" in - let headers = Request.default_headers in - let body = Request.write_as_json_body JsonSupport.of_string body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.to_string) resp body - -let test_body_with_file_schema ~file_schema_test_class_t = - let open Lwt in - let uri = Request.build_uri "/fake/body-with-file-schema" in - let headers = Request.default_headers in - let body = Request.write_as_json_body File_schema_test_class.to_yojson file_schema_test_class_t in - Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let test_body_with_query_params ~query ~user_t = - let open Lwt in - let uri = Request.build_uri "/fake/body-with-query-params" in - let headers = Request.default_headers in - let uri = Request.add_query_param uri "query" (fun x -> x) query in - let body = Request.write_as_json_body User.to_yojson user_t in - Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let test_client_model ~client_t = - let open Lwt in - let uri = Request.build_uri "/fake" in - let headers = Request.default_headers in - let body = Request.write_as_json_body Client.to_yojson client_t in - Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Client.of_yojson) resp body - -let test_endpoint_parameters ~number ~double ~pattern_without_delimiter ~byte ?integer ?int32 ?int64 ?float ?string ?binary ?date ?date_time ?password ?callback () = - let open Lwt in - let uri = Request.build_uri "/fake" in - let headers = Request.default_headers in - let body = Request.init_form_encoded_body () in - let body = Request.maybe_add_form_encoded_body_param body "integer" Int32.to_string integer in - let body = Request.maybe_add_form_encoded_body_param body "int32" Int32.to_string int32 in - let body = Request.maybe_add_form_encoded_body_param body "int64" Int64.to_string int64 in - let body = Request.add_form_encoded_body_param body "number" string_of_float number in - let body = Request.maybe_add_form_encoded_body_param body "float" string_of_float float in - let body = Request.add_form_encoded_body_param body "double" string_of_float double in - let body = Request.maybe_add_form_encoded_body_param body "string" (fun x -> x) string in - let body = Request.add_form_encoded_body_param body "pattern_without_delimiter" (fun x -> x) pattern_without_delimiter in - let body = Request.add_form_encoded_body_param body "byte" (fun x -> x) byte in - let body = Request.maybe_add_form_encoded_body_param body "binary" (fun x -> x) binary in - let body = Request.maybe_add_form_encoded_body_param body "date" (fun x -> x) date in - let body = Request.maybe_add_form_encoded_body_param body "date_time" (fun x -> x) date_time in - let body = Request.maybe_add_form_encoded_body_param body "password" (fun x -> x) password in - let body = Request.maybe_add_form_encoded_body_param body "callback" (fun x -> x) callback in - let body = Request.finalize_form_encoded_body body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let test_enum_parameters ?(enum_header_string_array = []) ?(enum_header_string = `Minusefg) ?(enum_query_string_array = []) ?(enum_query_string = `Minusefg) ?enum_query_integer ?enum_query_double ?(enum_form_string_array = [`Dollar]) ?(enum_form_string = `Minusefg) () = - let open Lwt in - let uri = Request.build_uri "/fake" in - let headers = Request.default_headers in - let headers = Request.add_header_multi headers "enum_header_string_array" (List.map Enums.show_enum_form_string_array) enum_header_string_array in - let headers = Request.add_header headers "enum_header_string" Enums.show_enumclass enum_header_string in - let uri = Request.add_query_param_list uri "enum_query_string_array" (List.map Enums.show_enum_form_string_array) enum_query_string_array in - let uri = Request.add_query_param uri "enum_query_string" Enums.show_enumclass enum_query_string in - let uri = Request.maybe_add_query_param uri "enum_query_integer" Enums.show_enum_query_integer enum_query_integer in - let uri = Request.maybe_add_query_param uri "enum_query_double" Enums.show_enum_number enum_query_double in - let body = Request.init_form_encoded_body () in - let body = Request.add_form_encoded_body_param_list body "enum_form_string_array" (List.map Enums.show_enum_form_string_array) enum_form_string_array in - let body = Request.add_form_encoded_body_param body "enum_form_string" Enums.show_enumclass enum_form_string in - let body = Request.finalize_form_encoded_body body in - Cohttp_lwt_unix.Client.call `GET uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let test_group_parameters ~required_string_group ~required_boolean_group ~required_int64_group ?string_group ?boolean_group ?int64_group () = - let open Lwt in - let uri = Request.build_uri "/fake" in - let headers = Request.default_headers in - let headers = Request.add_header headers "required_boolean_group" string_of_bool required_boolean_group in - let headers = Request.maybe_add_header headers "boolean_group" string_of_bool boolean_group in - let uri = Request.add_query_param uri "required_string_group" Int32.to_string required_string_group in - let uri = Request.add_query_param uri "required_int64_group" Int64.to_string required_int64_group in - let uri = Request.maybe_add_query_param uri "string_group" Int32.to_string string_group in - let uri = Request.maybe_add_query_param uri "int64_group" Int64.to_string int64_group in - Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> - Request.handle_unit_response resp - -let test_inline_additional_properties ~request_body = - let open Lwt in - let uri = Request.build_uri "/fake/inline-additionalProperties" in - let headers = Request.default_headers in - let body = Request.write_as_json_body (JsonSupport.of_map_of JsonSupport.of_string) request_body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let test_json_form_data ~param ~param2 = - let open Lwt in - let uri = Request.build_uri "/fake/jsonFormData" in - let headers = Request.default_headers in - let body = Request.init_form_encoded_body () in - let body = Request.add_form_encoded_body_param body "param" (fun x -> x) param in - let body = Request.add_form_encoded_body_param body "param2" (fun x -> x) param2 in - let body = Request.finalize_form_encoded_body body in - Cohttp_lwt_unix.Client.call `GET uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/fake_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/fake_api.mli deleted file mode 100644 index b10b27d6fb0..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/fake_api.mli +++ /dev/null @@ -1,20 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val fake_health_get : unit -> Health_check_result.t Lwt.t -val fake_outer_boolean_serialize : body:bool -> unit -> bool Lwt.t -val fake_outer_composite_serialize : outer_composite_t:Outer_composite.t -> unit -> Outer_composite.t Lwt.t -val fake_outer_number_serialize : body:float -> unit -> float Lwt.t -val fake_outer_string_serialize : body:string -> unit -> string Lwt.t -val test_body_with_file_schema : file_schema_test_class_t:File_schema_test_class.t -> unit Lwt.t -val test_body_with_query_params : query:string -> user_t:User.t -> unit Lwt.t -val test_client_model : client_t:Client.t -> Client.t Lwt.t -val test_endpoint_parameters : number:float -> double:float -> pattern_without_delimiter:string -> byte:string -> ?integer:int32 -> ?int32:int32 -> ?int64:int64 -> ?float:float -> ?string:string -> ?binary:string -> ?date:string -> ?date_time:string -> ?password:string -> ?callback:string -> unit -> unit Lwt.t -val test_enum_parameters : ?enum_header_string_array:Enums.enum_form_string_array list -> ?enum_header_string:Enums.enumclass -> ?enum_query_string_array:Enums.enum_form_string_array list -> ?enum_query_string:Enums.enumclass -> ?enum_query_integer:Enums.enum_query_integer -> ?enum_query_double:Enums.enum_number -> ?enum_form_string_array:Enums.enum_form_string_array list -> ?enum_form_string:Enums.enumclass -> unit -> unit Lwt.t -val test_group_parameters : required_string_group:int32 -> required_boolean_group:bool -> required_int64_group:int64 -> ?string_group:int32 -> ?boolean_group:bool -> ?int64_group:int64 -> unit -> unit Lwt.t -val test_inline_additional_properties : request_body:(string * string) list -> unit Lwt.t -val test_json_form_data : param:string -> param2:string -> unit Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.ml deleted file mode 100644 index 09bf9c3d63e..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.ml +++ /dev/null @@ -1,16 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let test_classname ~client_t = - let open Lwt in - let uri = Request.build_uri "/fake_classname_test" in - let headers = Request.default_headers in - let uri = Uri.add_query_param' uri ("api_key_query", Request.api_key) in - let body = Request.write_as_json_body Client.to_yojson client_t in - Cohttp_lwt_unix.Client.call `PATCH uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Client.of_yojson) resp body - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.mli deleted file mode 100644 index 0f9a292c507..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/fake_classname_tags123_api.mli +++ /dev/null @@ -1,8 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val test_classname : client_t:Client.t -> Client.t Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/pet_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/pet_api.ml deleted file mode 100644 index 64fbc19ba0f..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/pet_api.ml +++ /dev/null @@ -1,93 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let add_pet ~pet_t = - let open Lwt in - let uri = Request.build_uri "/pet" in - let headers = Request.default_headers in - let body = Request.write_as_json_body Pet.to_yojson pet_t in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let delete_pet ~pet_id ?api_key () = - let open Lwt in - let uri = Request.build_uri "/pet/{petId}" in - let headers = Request.default_headers in - let headers = Request.maybe_add_header headers "api_key" (fun x -> x) api_key in - let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in - Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> - Request.handle_unit_response resp - -let find_pets_by_status ~status = - let open Lwt in - let uri = Request.build_uri "/pet/findByStatus" in - let headers = Request.default_headers in - let uri = Request.add_query_param_list uri "status" (List.map Enums.show_pet_status) status in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as_list_of (JsonSupport.unwrap Pet.of_yojson) resp body - -let find_pets_by_tags ~tags = - let open Lwt in - let uri = Request.build_uri "/pet/findByTags" in - let headers = Request.default_headers in - let uri = Request.add_query_param_list uri "tags" (List.map (fun x -> x)) tags in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as_list_of (JsonSupport.unwrap Pet.of_yojson) resp body - -let get_pet_by_id ~pet_id = - let open Lwt in - let uri = Request.build_uri "/pet/{petId}" in - let headers = Request.default_headers in - let headers = Cohttp.Header.add headers "api_key" Request.api_key in - let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) resp body - -let update_pet ~pet_t = - let open Lwt in - let uri = Request.build_uri "/pet" in - let headers = Request.default_headers in - let body = Request.write_as_json_body Pet.to_yojson pet_t in - Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let update_pet_with_form ~pet_id ?name ?status () = - let open Lwt in - let uri = Request.build_uri "/pet/{petId}" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in - let body = Request.init_form_encoded_body () in - let body = Request.maybe_add_form_encoded_body_param body "name" (fun x -> x) name in - let body = Request.maybe_add_form_encoded_body_param body "status" (fun x -> x) status in - let body = Request.finalize_form_encoded_body body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let upload_file ~pet_id ?additional_metadata ?file () = - let open Lwt in - let uri = Request.build_uri "/pet/{petId}/uploadImage" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in - let body = Request.init_form_encoded_body () in - let body = Request.maybe_add_form_encoded_body_param body "additional_metadata" (fun x -> x) additional_metadata in - let body = Request.maybe_add_form_encoded_body_param body "file" (fun x -> x) file in - let body = Request.finalize_form_encoded_body body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Api_response.of_yojson) resp body - -let upload_file_with_required_file ~pet_id ~required_file ?additional_metadata () = - let open Lwt in - let uri = Request.build_uri "/fake/{petId}/uploadImageWithRequiredFile" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "petId" Int64.to_string pet_id in - let body = Request.init_form_encoded_body () in - let body = Request.maybe_add_form_encoded_body_param body "additional_metadata" (fun x -> x) additional_metadata in - let body = Request.add_form_encoded_body_param body "required_file" (fun x -> x) required_file in - let body = Request.finalize_form_encoded_body body in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Api_response.of_yojson) resp body - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/pet_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/pet_api.mli deleted file mode 100644 index b3f4af03ce5..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/pet_api.mli +++ /dev/null @@ -1,16 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val add_pet : pet_t:Pet.t -> unit Lwt.t -val delete_pet : pet_id:int64 -> ?api_key:string -> unit -> unit Lwt.t -val find_pets_by_status : status:Enums.pet_status list -> Pet.t list Lwt.t -val find_pets_by_tags : tags:string list -> Pet.t list Lwt.t -val get_pet_by_id : pet_id:int64 -> Pet.t Lwt.t -val update_pet : pet_t:Pet.t -> unit Lwt.t -val update_pet_with_form : pet_id:int64 -> ?name:string -> ?status:string -> unit -> unit Lwt.t -val upload_file : pet_id:int64 -> ?additional_metadata:string -> ?file:string -> unit -> Api_response.t Lwt.t -val upload_file_with_required_file : pet_id:int64 -> required_file:string -> ?additional_metadata:string -> unit -> Api_response.t Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/store_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/store_api.ml deleted file mode 100644 index f88b0217bfd..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/store_api.ml +++ /dev/null @@ -1,39 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let delete_order ~order_id = - let open Lwt in - let uri = Request.build_uri "/store/order/{order_id}" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "order_id" (fun x -> x) order_id in - Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> - Request.handle_unit_response resp - -let get_inventory () = - let open Lwt in - let uri = Request.build_uri "/store/inventory" in - let headers = Request.default_headers in - let headers = Cohttp.Header.add headers "api_key" Request.api_key in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as_map_of (JsonSupport.to_int32) resp body - -let get_order_by_id ~order_id = - let open Lwt in - let uri = Request.build_uri "/store/order/{order_id}" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "order_id" Int64.to_string order_id in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body - -let place_order ~order_t = - let open Lwt in - let uri = Request.build_uri "/store/order" in - let headers = Request.default_headers in - let body = Request.write_as_json_body Order.to_yojson order_t in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) resp body - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/store_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/store_api.mli deleted file mode 100644 index 63b09db9ca5..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/store_api.mli +++ /dev/null @@ -1,11 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val delete_order : order_id:string -> unit Lwt.t -val get_inventory : unit -> (string * int32) list Lwt.t -val get_order_by_id : order_id:int64 -> Order.t Lwt.t -val place_order : order_t:Order.t -> Order.t Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/user_api.ml b/samples/openapi3/client/petstore/ocaml/src/apis/user_api.ml deleted file mode 100644 index 9d1a563d1e8..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/user_api.ml +++ /dev/null @@ -1,72 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -let create_user ~user_t = - let open Lwt in - let uri = Request.build_uri "/user" in - let headers = Request.default_headers in - let body = Request.write_as_json_body User.to_yojson user_t in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let create_users_with_array_input ~user = - let open Lwt in - let uri = Request.build_uri "/user/createWithArray" in - let headers = Request.default_headers in - let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let create_users_with_list_input ~user = - let open Lwt in - let uri = Request.build_uri "/user/createWithList" in - let headers = Request.default_headers in - let body = Request.write_as_json_body (JsonSupport.of_list_of User.to_yojson) user in - Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - -let delete_user ~username = - let open Lwt in - let uri = Request.build_uri "/user/{username}" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "username" (fun x -> x) username in - Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> - Request.handle_unit_response resp - -let get_user_by_name ~username = - let open Lwt in - let uri = Request.build_uri "/user/{username}" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "username" (fun x -> x) username in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.unwrap User.of_yojson) resp body - -let login_user ~username ~password = - let open Lwt in - let uri = Request.build_uri "/user/login" in - let headers = Request.default_headers in - let uri = Request.add_query_param uri "username" (fun x -> x) username in - let uri = Request.add_query_param uri "password" (fun x -> x) password in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.read_json_body_as (JsonSupport.to_string) resp body - -let logout_user () = - let open Lwt in - let uri = Request.build_uri "/user/logout" in - let headers = Request.default_headers in - Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> - Request.handle_unit_response resp - -let update_user ~username ~user_t = - let open Lwt in - let uri = Request.build_uri "/user/{username}" in - let headers = Request.default_headers in - let uri = Request.replace_path_param uri "username" (fun x -> x) username in - let body = Request.write_as_json_body User.to_yojson user_t in - Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (resp, body) -> - Request.handle_unit_response resp - diff --git a/samples/openapi3/client/petstore/ocaml/src/apis/user_api.mli b/samples/openapi3/client/petstore/ocaml/src/apis/user_api.mli deleted file mode 100644 index 9a7e8e59c3a..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/apis/user_api.mli +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -val create_user : user_t:User.t -> unit Lwt.t -val create_users_with_array_input : user:User.t list -> unit Lwt.t -val create_users_with_list_input : user:User.t list -> unit Lwt.t -val delete_user : username:string -> unit Lwt.t -val get_user_by_name : username:string -> User.t Lwt.t -val login_user : username:string -> password:string -> string Lwt.t -val logout_user : unit -> unit Lwt.t -val update_user : username:string -> user_t:User.t -> unit Lwt.t diff --git a/samples/openapi3/client/petstore/ocaml/src/models/additional_properties_class.ml b/samples/openapi3/client/petstore/ocaml/src/models/additional_properties_class.ml deleted file mode 100644 index 9dcaf86f9ec..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/additional_properties_class.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - map_property: (string * string) list; - map_of_map_property: (string * (string * string) list) list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - map_property = []; - map_of_map_property = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/animal.ml b/samples/openapi3/client/petstore/ocaml/src/models/animal.ml deleted file mode 100644 index ac1ea09d155..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/animal.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - class_name: string; - color: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (class_name : string) : t = { - class_name = class_name; - color = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/api_response.ml b/samples/openapi3/client/petstore/ocaml/src/models/api_response.ml deleted file mode 100644 index 7e79b466928..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/api_response.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - code: int32 option [@default None]; - _type: string option [@default None]; - message: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - code = None; - _type = None; - message = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/array_of_array_of_number_only.ml b/samples/openapi3/client/petstore/ocaml/src/models/array_of_array_of_number_only.ml deleted file mode 100644 index b88dfe66f25..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/array_of_array_of_number_only.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - array_array_number: float list list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - array_array_number = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/array_of_number_only.ml b/samples/openapi3/client/petstore/ocaml/src/models/array_of_number_only.ml deleted file mode 100644 index 88d8440639c..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/array_of_number_only.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - array_number: float list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - array_number = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/array_test.ml b/samples/openapi3/client/petstore/ocaml/src/models/array_test.ml deleted file mode 100644 index dc3ec34c9f9..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/array_test.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - array_of_string: string list; - array_array_of_integer: int64 list list; - array_array_of_model: Read_only_first.t list list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - array_of_string = []; - array_array_of_integer = []; - array_array_of_model = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/capitalization.ml b/samples/openapi3/client/petstore/ocaml/src/models/capitalization.ml deleted file mode 100644 index 7ea60bc00ad..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/capitalization.ml +++ /dev/null @@ -1,26 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - small_camel: string option [@default None]; - capital_camel: string option [@default None]; - small_snake: string option [@default None]; - capital_snake: string option [@default None]; - sca_eth_flow_points: string option [@default None]; - (* Name of the pet *) - att_name: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - small_camel = None; - capital_camel = None; - small_snake = None; - capital_snake = None; - sca_eth_flow_points = None; - att_name = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/cat.ml b/samples/openapi3/client/petstore/ocaml/src/models/cat.ml deleted file mode 100644 index bd28b8ab731..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/cat.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - class_name: string; - color: string option [@default None]; - declawed: bool option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (class_name : string) : t = { - class_name = class_name; - color = None; - declawed = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/cat_all_of.ml b/samples/openapi3/client/petstore/ocaml/src/models/cat_all_of.ml deleted file mode 100644 index 8ef4045a61f..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/cat_all_of.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - declawed: bool option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - declawed = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/category.ml b/samples/openapi3/client/petstore/ocaml/src/models/category.ml deleted file mode 100644 index cb4c98edec4..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/category.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - id: int64 option [@default None]; - name: string; -} [@@deriving yojson { strict = false }, show ];; - -let create (name : string) : t = { - id = None; - name = name; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/class_model.ml b/samples/openapi3/client/petstore/ocaml/src/models/class_model.ml deleted file mode 100644 index 69dfbf46dcc..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/class_model.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - * Schema Class_model.t : Model for testing model with \''_class\'' property - *) - -type t = { - _class: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -(** Model for testing model with \''_class\'' property *) -let create () : t = { - _class = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/client.ml b/samples/openapi3/client/petstore/ocaml/src/models/client.ml deleted file mode 100644 index 20ccd895114..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/client.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - client: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - client = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/dog.ml b/samples/openapi3/client/petstore/ocaml/src/models/dog.ml deleted file mode 100644 index e3dd000c8d6..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/dog.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - class_name: string; - color: string option [@default None]; - breed: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (class_name : string) : t = { - class_name = class_name; - color = None; - breed = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/dog_all_of.ml b/samples/openapi3/client/petstore/ocaml/src/models/dog_all_of.ml deleted file mode 100644 index 1a02a8d8b9a..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/dog_all_of.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - breed: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - breed = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/enum_arrays.ml b/samples/openapi3/client/petstore/ocaml/src/models/enum_arrays.ml deleted file mode 100644 index 99953247de1..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/enum_arrays.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - just_symbol: Enums.just_symbol option [@default None]; - array_enum: Enums.array_enum list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - just_symbol = None; - array_enum = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/enum_test.ml b/samples/openapi3/client/petstore/ocaml/src/models/enum_test.ml deleted file mode 100644 index 67d474406f5..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/enum_test.ml +++ /dev/null @@ -1,29 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - enum_string: Enums.enum_string option [@default None]; - enum_string_required: Enums.enum_string; - enum_integer: Enums.enum_integer option [@default None]; - enum_number: Enums.enum_number option [@default None]; - outer_enum: Enums.status option [@default None]; - outer_enum_integer: Enums.outerenuminteger option [@default None]; - outer_enum_default_value: Enums.status option [@default None]; - outer_enum_integer_default_value: Enums.outerenuminteger option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (enum_string_required : Enums.enum_string) : t = { - enum_string = None; - enum_string_required = enum_string_required; - enum_integer = None; - enum_number = None; - outer_enum = None; - outer_enum_integer = None; - outer_enum_default_value = None; - outer_enum_integer_default_value = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/file.ml b/samples/openapi3/client/petstore/ocaml/src/models/file.ml deleted file mode 100644 index 72df1e20230..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/file.ml +++ /dev/null @@ -1,18 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - * Schema File.t : Must be named `File` for test. - *) - -type t = { - (* Test capitalization *) - source_uri: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -(** Must be named `File` for test. *) -let create () : t = { - source_uri = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/file_schema_test_class.ml b/samples/openapi3/client/petstore/ocaml/src/models/file_schema_test_class.ml deleted file mode 100644 index 6ce6e13efda..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/file_schema_test_class.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - file: File.t option [@default None]; - files: File.t list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - file = None; - files = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/foo.ml b/samples/openapi3/client/petstore/ocaml/src/models/foo.ml deleted file mode 100644 index 73821fc1aaf..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/foo.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - bar: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - bar = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/format_test.ml b/samples/openapi3/client/petstore/ocaml/src/models/format_test.ml deleted file mode 100644 index a2c8bc72c5a..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/format_test.ml +++ /dev/null @@ -1,45 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - integer: int32 option [@default None]; - int32: int32 option [@default None]; - int64: int64 option [@default None]; - number: float; - float: float option [@default None]; - double: float option [@default None]; - string: string option [@default None]; - byte: string; - binary: string option [@default None]; - date: string; - date_time: string option [@default None]; - uuid: string option [@default None]; - password: string; - (* A string that is a 10 digit number. Can have leading zeros. *) - pattern_with_digits: string option [@default None]; - (* A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. *) - pattern_with_digits_and_delimiter: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (number : float) (byte : string) (date : string) (password : string) : t = { - integer = None; - int32 = None; - int64 = None; - number = number; - float = None; - double = None; - string = None; - byte = byte; - binary = None; - date = date; - date_time = None; - uuid = None; - password = password; - pattern_with_digits = None; - pattern_with_digits_and_delimiter = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/has_only_read_only.ml b/samples/openapi3/client/petstore/ocaml/src/models/has_only_read_only.ml deleted file mode 100644 index 54db5e69ad7..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/has_only_read_only.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - bar: string option [@default None]; - foo: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - bar = None; - foo = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/health_check_result.ml b/samples/openapi3/client/petstore/ocaml/src/models/health_check_result.ml deleted file mode 100644 index 4ff90c6cb4d..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/health_check_result.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - * Schema Health_check_result.t : Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. - *) - -type t = { - nullable_message: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -(** Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. *) -let create () : t = { - nullable_message = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_2.ml b/samples/openapi3/client/petstore/ocaml/src/models/inline_object_2.ml deleted file mode 100644 index 1a007a7afe4..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_2.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - (* Form parameter enum test (string array) *) - enum_form_string_array: Enums.enum_form_string_array list; - (* Form parameter enum test (string) *) - enum_form_string: Enums.enumclass option [@default Some(`Minusefg)]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - enum_form_string_array = []; - enum_form_string = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_3.ml b/samples/openapi3/client/petstore/ocaml/src/models/inline_object_3.ml deleted file mode 100644 index 7d58d3cdbe5..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_3.ml +++ /dev/null @@ -1,55 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - (* None *) - integer: int32 option [@default None]; - (* None *) - int32: int32 option [@default None]; - (* None *) - int64: int64 option [@default None]; - (* None *) - number: float; - (* None *) - float: float option [@default None]; - (* None *) - double: float; - (* None *) - string: string option [@default None]; - (* None *) - pattern_without_delimiter: string; - (* None *) - byte: string; - (* None *) - binary: string option [@default None]; - (* None *) - date: string option [@default None]; - (* None *) - date_time: string option [@default None]; - (* None *) - password: string option [@default None]; - (* None *) - callback: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (number : float) (double : float) (pattern_without_delimiter : string) (byte : string) : t = { - integer = None; - int32 = None; - int64 = None; - number = number; - float = None; - double = double; - string = None; - pattern_without_delimiter = pattern_without_delimiter; - byte = byte; - binary = None; - date = None; - date_time = None; - password = None; - callback = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_4.ml b/samples/openapi3/client/petstore/ocaml/src/models/inline_object_4.ml deleted file mode 100644 index 8914801491a..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_4.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - (* field1 *) - param: string; - (* field2 *) - param2: string; -} [@@deriving yojson { strict = false }, show ];; - -let create (param : string) (param2 : string) : t = { - param = param; - param2 = param2; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_5.ml b/samples/openapi3/client/petstore/ocaml/src/models/inline_object_5.ml deleted file mode 100644 index 14ca3e41a98..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/inline_object_5.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - (* Additional data to pass to server *) - additional_metadata: string option [@default None]; - (* file to upload *) - required_file: string; -} [@@deriving yojson { strict = false }, show ];; - -let create (required_file : string) : t = { - additional_metadata = None; - required_file = required_file; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/inline_response_default.ml b/samples/openapi3/client/petstore/ocaml/src/models/inline_response_default.ml deleted file mode 100644 index b30b92591bd..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/inline_response_default.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - string: Foo.t option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - string = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/map_test.ml b/samples/openapi3/client/petstore/ocaml/src/models/map_test.ml deleted file mode 100644 index 2bdd8f156b4..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/map_test.ml +++ /dev/null @@ -1,21 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - map_map_of_string: (string * (string * string) list) list; - map_of_enum_string: (string * Enums.map_of_enum_string) list; - direct_map: (string * bool) list; - indirect_map: (string * bool) list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - map_map_of_string = []; - map_of_enum_string = []; - direct_map = []; - indirect_map = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/mixed_properties_and_additional_properties_class.ml b/samples/openapi3/client/petstore/ocaml/src/models/mixed_properties_and_additional_properties_class.ml deleted file mode 100644 index ba41c7e7069..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/mixed_properties_and_additional_properties_class.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - uuid: string option [@default None]; - date_time: string option [@default None]; - map: (string * Animal.t) list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - uuid = None; - date_time = None; - map = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/model_200_response.ml b/samples/openapi3/client/petstore/ocaml/src/models/model_200_response.ml deleted file mode 100644 index 4cd900d8a58..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/model_200_response.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - * Schema Model_200_response.t : Model for testing model name starting with number - *) - -type t = { - name: int32 option [@default None]; - _class: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -(** Model for testing model name starting with number *) -let create () : t = { - name = None; - _class = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/model__special_model_name_.ml b/samples/openapi3/client/petstore/ocaml/src/models/model__special_model_name_.ml deleted file mode 100644 index 61bc6d001f4..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/model__special_model_name_.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - special_property_name: int64 option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - special_property_name = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/name.ml b/samples/openapi3/client/petstore/ocaml/src/models/name.ml deleted file mode 100644 index dc4d8da8fd8..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/name.ml +++ /dev/null @@ -1,23 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - * Schema Name.t : Model for testing model name same as property name - *) - -type t = { - name: int32; - snake_case: int32 option [@default None]; - property: string option [@default None]; - var_123_number: int32 option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -(** Model for testing model name same as property name *) -let create (name : int32) : t = { - name = name; - snake_case = None; - property = None; - var_123_number = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/nullable_class.ml b/samples/openapi3/client/petstore/ocaml/src/models/nullable_class.ml deleted file mode 100644 index e48c6f0d324..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/nullable_class.ml +++ /dev/null @@ -1,37 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - integer_prop: int32 option [@default None]; - number_prop: float option [@default None]; - boolean_prop: bool option [@default None]; - string_prop: string option [@default None]; - date_prop: string option [@default None]; - datetime_prop: string option [@default None]; - array_nullable_prop: Yojson.Safe.t list; - array_and_items_nullable_prop: Yojson.Safe.t list; - array_items_nullable: Yojson.Safe.t list; - object_nullable_prop: (string * Yojson.Safe.t) list; - object_and_items_nullable_prop: (string * Yojson.Safe.t) list; - object_items_nullable: (string * Yojson.Safe.t) list; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - integer_prop = None; - number_prop = None; - boolean_prop = None; - string_prop = None; - date_prop = None; - datetime_prop = None; - array_nullable_prop = []; - array_and_items_nullable_prop = []; - array_items_nullable = []; - object_nullable_prop = []; - object_and_items_nullable_prop = []; - object_items_nullable = []; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/number_only.ml b/samples/openapi3/client/petstore/ocaml/src/models/number_only.ml deleted file mode 100644 index 907a9acac9b..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/number_only.ml +++ /dev/null @@ -1,15 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - just_number: float option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - just_number = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/order.ml b/samples/openapi3/client/petstore/ocaml/src/models/order.ml deleted file mode 100644 index 19ddf1e02e6..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/order.ml +++ /dev/null @@ -1,26 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - id: int64 option [@default None]; - pet_id: int64 option [@default None]; - quantity: int32 option [@default None]; - ship_date: string option [@default None]; - (* Order Status *) - status: Enums.status option [@default None]; - complete: bool option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - id = None; - pet_id = None; - quantity = None; - ship_date = None; - status = None; - complete = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/outer_composite.ml b/samples/openapi3/client/petstore/ocaml/src/models/outer_composite.ml deleted file mode 100644 index ab5d8902e08..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/outer_composite.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - my_number: float option [@default None]; - my_string: string option [@default None]; - my_boolean: bool option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - my_number = None; - my_string = None; - my_boolean = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/pet.ml b/samples/openapi3/client/petstore/ocaml/src/models/pet.ml deleted file mode 100644 index 10d93f2552d..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/pet.ml +++ /dev/null @@ -1,26 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - id: int64 option [@default None]; - category: Category.t option [@default None]; - name: string; - photo_urls: string list; - tags: Tag.t list; - (* pet status in the store *) - status: Enums.pet_status option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create (name : string) (photo_urls : string list) : t = { - id = None; - category = None; - name = name; - photo_urls = photo_urls; - tags = []; - status = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/read_only_first.ml b/samples/openapi3/client/petstore/ocaml/src/models/read_only_first.ml deleted file mode 100644 index 7ebca9b2119..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/read_only_first.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - bar: string option [@default None]; - baz: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - bar = None; - baz = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/return.ml b/samples/openapi3/client/petstore/ocaml/src/models/return.ml deleted file mode 100644 index cb27db04936..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/return.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - * Schema Return.t : Model for testing reserved words - *) - -type t = { - return: int32 option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -(** Model for testing reserved words *) -let create () : t = { - return = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/tag.ml b/samples/openapi3/client/petstore/ocaml/src/models/tag.ml deleted file mode 100644 index 4dc25fdca67..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/tag.ml +++ /dev/null @@ -1,17 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - id: int64 option [@default None]; - name: string option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - id = None; - name = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/models/user.ml b/samples/openapi3/client/petstore/ocaml/src/models/user.ml deleted file mode 100644 index 81e7d4e4e02..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/models/user.ml +++ /dev/null @@ -1,30 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type t = { - id: int64 option [@default None]; - username: string option [@default None]; - first_name: string option [@default None]; - last_name: string option [@default None]; - email: string option [@default None]; - password: string option [@default None]; - phone: string option [@default None]; - (* User Status *) - user_status: int32 option [@default None]; -} [@@deriving yojson { strict = false }, show ];; - -let create () : t = { - id = None; - username = None; - first_name = None; - last_name = None; - email = None; - password = None; - phone = None; - user_status = None; -} - diff --git a/samples/openapi3/client/petstore/ocaml/src/support/enums.ml b/samples/openapi3/client/petstore/ocaml/src/support/enums.ml deleted file mode 100644 index 63ec5f49f85..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/support/enums.ml +++ /dev/null @@ -1,142 +0,0 @@ -(* - * This file has been generated by the OCamlClientCodegen generator for openapi-generator. - * - * Generated by: https://openapi-generator.tech - * - *) - -type outerenuminteger = [ -| `_0 [@printer fun fmt _ -> Format.pp_print_string fmt "0"] [@name "0"] -| `_1 [@printer fun fmt _ -> Format.pp_print_string fmt "1"] [@name "1"] -| `_2 [@printer fun fmt _ -> Format.pp_print_string fmt "2"] [@name "2"] -] [@@deriving yojson, show { with_path = false }];; - -let outerenuminteger_of_yojson json = outerenuminteger_of_yojson (`List [json]) -let outerenuminteger_to_yojson e = - match outerenuminteger_to_yojson e with - | `List [json] -> json - | json -> json - -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 }];; - -let status_of_yojson json = status_of_yojson (`List [json]) -let status_to_yojson e = - match status_to_yojson e with - | `List [json] -> json - | json -> json - -type enum_query_integer = [ -| `_1 [@printer fun fmt _ -> Format.pp_print_string fmt "1"] [@name "1"] -| `Minus2 [@printer fun fmt _ -> Format.pp_print_string fmt "-2"] [@name "-2"] -] [@@deriving yojson, show { with_path = false }];; - -let enum_query_integer_of_yojson json = enum_query_integer_of_yojson (`List [json]) -let enum_query_integer_to_yojson e = - match enum_query_integer_to_yojson e with - | `List [json] -> json - | json -> json - -type enum_form_string_array = [ -| `Greater_Than [@printer fun fmt _ -> Format.pp_print_string fmt ">"] [@name ">"] -| `Dollar [@printer fun fmt _ -> Format.pp_print_string fmt "$"] [@name "$"] -] [@@deriving yojson, show { with_path = false }];; - -let enum_form_string_array_of_yojson json = enum_form_string_array_of_yojson (`List [json]) -let enum_form_string_array_to_yojson e = - match enum_form_string_array_to_yojson e with - | `List [json] -> json - | json -> json - -type enum_number = [ -| `_1Period1 [@printer fun fmt _ -> Format.pp_print_string fmt "1.1"] [@name "1.1"] -| `Minus1Period2 [@printer fun fmt _ -> Format.pp_print_string fmt "-1.2"] [@name "-1.2"] -] [@@deriving yojson, show { with_path = false }];; - -let enum_number_of_yojson json = enum_number_of_yojson (`List [json]) -let enum_number_to_yojson e = - match enum_number_to_yojson e with - | `List [json] -> json - | json -> json - -type map_of_enum_string = [ -| `UPPER [@printer fun fmt _ -> Format.pp_print_string fmt "UPPER"] [@name "UPPER"] -| `Lower [@printer fun fmt _ -> Format.pp_print_string fmt "lower"] [@name "lower"] -] [@@deriving yojson, show { with_path = false }];; - -let map_of_enum_string_of_yojson json = map_of_enum_string_of_yojson (`List [json]) -let map_of_enum_string_to_yojson e = - match map_of_enum_string_to_yojson e with - | `List [json] -> json - | json -> json - -type enum_integer = [ -| `_1 [@printer fun fmt _ -> Format.pp_print_string fmt "1"] [@name "1"] -| `Minus1 [@printer fun fmt _ -> Format.pp_print_string fmt "-1"] [@name "-1"] -] [@@deriving yojson, show { with_path = false }];; - -let enum_integer_of_yojson json = enum_integer_of_yojson (`List [json]) -let enum_integer_to_yojson e = - match enum_integer_to_yojson e with - | `List [json] -> json - | json -> json - -type just_symbol = [ -| `Greater_ThanEqual [@printer fun fmt _ -> Format.pp_print_string fmt ">="] [@name ">="] -| `Dollar [@printer fun fmt _ -> Format.pp_print_string fmt "$"] [@name "$"] -] [@@deriving yojson, show { with_path = false }];; - -let just_symbol_of_yojson json = just_symbol_of_yojson (`List [json]) -let just_symbol_to_yojson e = - match just_symbol_to_yojson e with - | `List [json] -> json - | json -> json - -type array_enum = [ -| `Fish [@printer fun fmt _ -> Format.pp_print_string fmt "fish"] [@name "fish"] -| `Crab [@printer fun fmt _ -> Format.pp_print_string fmt "crab"] [@name "crab"] -] [@@deriving yojson, show { with_path = false }];; - -let array_enum_of_yojson json = array_enum_of_yojson (`List [json]) -let array_enum_to_yojson e = - match array_enum_to_yojson e with - | `List [json] -> json - | json -> json - -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 }];; - -let pet_status_of_yojson json = pet_status_of_yojson (`List [json]) -let pet_status_to_yojson e = - match pet_status_to_yojson e with - | `List [json] -> json - | json -> json - -type enumclass = [ -| `_abc [@printer fun fmt _ -> Format.pp_print_string fmt "_abc"] [@name "_abc"] -| `Minusefg [@printer fun fmt _ -> Format.pp_print_string fmt "-efg"] [@name "-efg"] -| `Left_ParenthesisxyzRight_Parenthesis [@printer fun fmt _ -> Format.pp_print_string fmt "(xyz)"] [@name "(xyz)"] -] [@@deriving yojson, show { with_path = false }];; - -let enumclass_of_yojson json = enumclass_of_yojson (`List [json]) -let enumclass_to_yojson e = - match enumclass_to_yojson e with - | `List [json] -> json - | json -> json - -type enum_string = [ -| `UPPER [@printer fun fmt _ -> Format.pp_print_string fmt "UPPER"] [@name "UPPER"] -| `Lower [@printer fun fmt _ -> Format.pp_print_string fmt "lower"] [@name "lower"] -] [@@deriving yojson, show { with_path = false }];; - -let enum_string_of_yojson json = enum_string_of_yojson (`List [json]) -let enum_string_to_yojson e = - match enum_string_to_yojson e with - | `List [json] -> json - | json -> json diff --git a/samples/openapi3/client/petstore/ocaml/src/support/jsonSupport.ml b/samples/openapi3/client/petstore/ocaml/src/support/jsonSupport.ml deleted file mode 100644 index 4b0fac77545..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/support/jsonSupport.ml +++ /dev/null @@ -1,55 +0,0 @@ -open Ppx_deriving_yojson_runtime - -let unwrap to_json json = - match to_json json with - | Result.Ok json -> json - | Result.Error s -> failwith s - -let to_int json = - match json with - | `Int x -> x - | `Intlit s -> int_of_string s - | _ -> failwith "JsonSupport.to_int" - -let to_bool json = - match json with - | `Bool x -> x - | _ -> failwith "JsonSupport.to_bool" - -let to_float json = - match json with - | `Float x -> x - | _ -> failwith "JsonSupport.to_float" - -let to_string json = - match json with - | `String s -> s - | _ -> failwith "JsonSupport.to_string" - -let to_int32 json : int32 = - match json with - | `Int x -> Int32.of_int x - | `Intlit s -> Int32.of_string s - | _ -> failwith "JsonSupport.to_int32" - -let to_int64 json : int64 = - match json with - | `Int x -> Int64.of_int x - | `Intlit s -> Int64.of_string s - | _ -> failwith "JsonSupport.to_int64" - -let of_int x = `Int x - -let of_bool b = `Bool b - -let of_float x = `Float x - -let of_string s = `String s - -let of_int32 x = `Intlit (Int32.to_string x) - -let of_int64 x = `Intlit (Int64.to_string x) - -let of_list_of of_f l = `List (List.map of_f l) - -let of_map_of of_f l = `Assoc (List.map (fun (k, v) -> (k, of_f v)) l) \ No newline at end of file diff --git a/samples/openapi3/client/petstore/ocaml/src/support/request.ml b/samples/openapi3/client/petstore/ocaml/src/support/request.ml deleted file mode 100644 index 98f4dfd43a4..00000000000 --- a/samples/openapi3/client/petstore/ocaml/src/support/request.ml +++ /dev/null @@ -1,97 +0,0 @@ -let api_key = "" -let base_url = "http://petstore.swagger.io:80/v2" -let default_headers = Cohttp.Header.init_with "Content-Type" "application/json" - -let option_fold f default o = - match o with - | Some v -> f v - | None -> default - -let build_uri operation_path = Uri.of_string (base_url ^ operation_path) - -let add_string_header headers key value = - Cohttp.Header.add headers key value - -let add_string_header_multi headers key values = - Cohttp.Header.add_multi headers key values - -let add_header headers key to_string value = - Cohttp.Header.add headers key (to_string value) - -let add_header_multi headers key to_string value = - Cohttp.Header.add_multi headers key (to_string value) - -let maybe_add_header headers key to_string value = - option_fold (add_header headers key to_string) headers value - -let maybe_add_header_multi headers key to_string value = - option_fold (add_header_multi headers key to_string) headers value - -let write_string_body s = Cohttp_lwt.Body.of_string s - -let write_json_body payload = - Cohttp_lwt.Body.of_string (Yojson.Safe.to_string payload ~std:true) - -let write_as_json_body to_json payload = write_json_body (to_json payload) - -let handle_response resp on_success_handler = - match Cohttp_lwt.Response.status resp with - | #Cohttp.Code.success_status -> on_success_handler () - | s -> failwith ("Server responded with status " ^ Cohttp.Code.(reason_phrase_of_code (code_of_status s))) - -let handle_unit_response resp = handle_response resp (fun () -> Lwt.return ()) - -let read_json_body resp body = - handle_response resp (fun () -> - (Lwt.(Cohttp_lwt.Body.to_string body >|= Yojson.Safe.from_string))) - -let read_json_body_as of_json resp body = - Lwt.(read_json_body resp body >|= of_json) - -let read_json_body_as_list resp body = - Lwt.(read_json_body resp body >|= Yojson.Safe.Util.to_list) - -let read_json_body_as_list_of of_json resp body = - Lwt.(read_json_body_as_list resp body >|= List.map of_json) - -let read_json_body_as_map resp body = - Lwt.(read_json_body resp body >|= Yojson.Safe.Util.to_assoc) - -let read_json_body_as_map_of of_json resp body = - Lwt.(read_json_body_as_map resp body >|= List.map (fun (s, v) -> (s, of_json v))) - -let replace_string_path_param uri param_name param_value = - let regexp = Str.regexp (Str.quote ("{" ^ param_name ^ "}")) in - let path = Str.global_replace regexp param_value (Uri.pct_decode (Uri.path uri)) in - Uri.with_path uri path - -let replace_path_param uri param_name to_string param_value = - replace_string_path_param uri param_name (to_string param_value) - -let maybe_replace_path_param uri param_name to_string param_value = - option_fold (replace_path_param uri param_name to_string) uri param_value - -let add_query_param uri param_name to_string param_value = - Uri.add_query_param' uri (param_name, to_string param_value) - -let add_query_param_list uri param_name to_string param_value = - Uri.add_query_param uri (param_name, to_string param_value) - -let maybe_add_query_param uri param_name to_string param_value = - option_fold (add_query_param uri param_name to_string) uri param_value - -let init_form_encoded_body () = "" - -let add_form_encoded_body_param params param_name to_string param_value = - let new_param_enc = Printf.sprintf {|%s=%s|} (Uri.pct_encode param_name) (Uri.pct_encode (to_string param_value)) in - if params = "" - then new_param_enc - else Printf.sprintf {|%s&%s|} params new_param_enc - -let add_form_encoded_body_param_list params param_name to_string new_params = - add_form_encoded_body_param params param_name (String.concat ",") (to_string new_params) - -let maybe_add_form_encoded_body_param params param_name to_string param_value = - option_fold (add_form_encoded_body_param params param_name to_string) params param_value - -let finalize_form_encoded_body body = Cohttp_lwt.Body.of_string body