Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8ad109e
Début d'un générateur pour OCaml.
Jul 12, 2019
6eee563
Ajout du script bash de generation pour OCaml.
Jul 13, 2019
428f682
Implémentation de la partie model du générateur OCaml.
cgensoul Jul 16, 2019
80dcf79
Suppression du fichier Model.mustache.
Jul 16, 2019
305c9aa
Légère modification dans le générateur OCaml.
Jul 16, 2019
8de8ef6
Début d'implémentation de la génération des opérations.
cgensoul Jul 16, 2019
ee3cef7
Avancées dans l'implémenatation des opérations.
cgensoul Jul 17, 2019
6d954f7
Avancée dans la gestion des enums : reste à traiter le fait que Yojso…
Jul 18, 2019
06619ac
Prise en compte du fait que Yojson représente les variants constants …
cgensoul Jul 18, 2019
b2cb9a2
Utilisation des variants polymorphe pour les enums car il se peut que…
Jul 19, 2019
8346f9f
Avancées dans le générateur de code OCaml : le code produit compile e…
Jul 19, 2019
80a9884
More tests.
Jul 19, 2019
5c7e0e0
Correction de problèmes dans la génération mis en évidence par l'util…
Jul 22, 2019
ef6c19c
Mapping du case Error de Ppx_deriving_yojson_runtime.ok_error vers l'…
Jul 22, 2019
83d0d17
Ajout de la génération des fichiers d'interfaces .mli pour les APIs.
Jul 22, 2019
afcfc1a
Ajout du support des parametres de type x-www-form-urlencoded.
Jul 23, 2019
4c63dfe
Le paramètres d'url de type number étaient mal gérés.
Jul 23, 2019
4f1f2fc
Cleanup.
Jul 23, 2019
55c81ef
Replace block comment start and end sequences in input text.
Jul 23, 2019
aa978f6
Make apis calls without a return type return unit rather than Yojson.…
Jul 23, 2019
28477e6
Make modules/openapi-generator/src/test/resources/3_0/petstore-with-f…
Jul 24, 2019
382eefe
Better handling of enums and map container and better sanitizing of g…
Jul 24, 2019
cce2152
Added generated code for modules/openapi-generator/src/test/resources…
Jul 24, 2019
eaad2bc
Correcting a violation : using toLowerCase without relying on the def…
Jul 24, 2019
c723573
Changed authoring in partial_header.mustache.
Jul 24, 2019
391de4e
Deleted commented code.
Jul 24, 2019
9287c8e
Collect enum schemas in items properties of operation parameters in t…
cgensoul Jul 24, 2019
b0b943b
Collect enums also in additional properties schemas of operation para…
cgensoul Jul 24, 2019
ba65b78
Removed copy-pasted Copyright notice from SmartBear.
cgensoul Jul 25, 2019
277822c
update doc
wing328 Jul 25, 2019
d80f22a
Use Locale.ROOT instead of Locale.ENGLISH for toLowerCase calls.
Jul 25, 2019
55bcfb7
Make GET operations with body generate compilable code.
Jul 25, 2019
67a2b38
Updated ocaml-client generated samples using the latest version of th…
Jul 25, 2019
b9545de
Added [@default None] for record fields with option types so that if …
Jul 25, 2019
70762d4
Added support of api keys in query params.
Jul 25, 2019
2b093bd
Updated generated ocaml samples to reflect latest changes in templates.
Jul 25, 2019
a2073f1
Added [@default] on enum record fields for which the enum type has on…
Jul 26, 2019
ecc8922
Delete useless space character in template.
cgensoul Jul 27, 2019
c4535f4
Added proper handling of http response codes.
cgensoul Jul 27, 2019
4b5d0aa
Updated generated ocaml samples to reflect latest changes in templates.
cgensoul Jul 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated ocaml-client generated samples using the latest version of th…
…e OCaml code generator.
  • Loading branch information
Christophe Gensoul committed Jul 25, 2019
commit 67a2b38f07517b7a04920e9253ac7dfcdff34d3f
16 changes: 8 additions & 8 deletions samples/client/petstore/ocaml-client/src/apis/pet_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@ let add_pet body =
let uri = Request.build_uri "/pet" in
let headers = Request.default_headers in
let body = Request.write_json_body Pet.to_yojson body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) -> return ()

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 = Cohttp.Header.add headers "api_key" (api_key) in
let uri = Request.replace_path_param uri "petId" (Int64.to_string pet_id) in
Cohttp_lwt_unix.Client.delete uri ~headers >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (_resp, body) -> return ()

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 = Uri.add_query_param uri ("status", List.map Enums.show_pet_status status) in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as_list_of (JsonSupport.unwrap Pet.of_yojson) 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 = Uri.add_query_param uri ("tags", tags) in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as_list_of (JsonSupport.unwrap Pet.of_yojson) 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 uri = Request.replace_path_param uri "petId" (Int64.to_string pet_id) in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as (JsonSupport.unwrap Pet.of_yojson) body

let update_pet body =
let open Lwt in
let uri = Request.build_uri "/pet" in
let headers = Request.default_headers in
let body = Request.write_json_body Pet.to_yojson body in
Cohttp_lwt_unix.Client.put uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (_resp, body) -> return ()

let update_pet_with_form pet_id name status =
let open Lwt in
Expand All @@ -60,7 +60,7 @@ let update_pet_with_form pet_id name status =
let body = Request.add_form_encoded_body_param body ("name", name) in
let body = Request.add_form_encoded_body_param body ("status", status) in
let body = Request.finalize_form_encoded_body body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) -> return ()

let upload_file pet_id additional_metadata file =
let open Lwt in
Expand All @@ -71,6 +71,6 @@ let upload_file pet_id additional_metadata file =
let body = Request.add_form_encoded_body_param body ("additional_metadata", additional_metadata) in
let body = Request.add_form_encoded_body_param body ("file", file) in
let body = Request.finalize_form_encoded_body body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) ->
Request.read_json_body_as (JsonSupport.unwrap Api_response.of_yojson) body

8 changes: 4 additions & 4 deletions samples/client/petstore/ocaml-client/src/apis/store_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ let delete_order order_id =
let uri = Request.build_uri "/store/order/{orderId}" in
let headers = Request.default_headers in
let uri = Request.replace_path_param uri "orderId" (order_id) in
Cohttp_lwt_unix.Client.delete uri ~headers >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (_resp, body) -> return ()

let get_inventory () =
let open Lwt in
let uri = Request.build_uri "/store/inventory" in
let headers = Request.default_headers in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as_map_of (JsonSupport.to_int32) body

let get_order_by_id order_id =
let open Lwt in
let uri = Request.build_uri "/store/order/{orderId}" in
let headers = Request.default_headers in
let uri = Request.replace_path_param uri "orderId" (Int64.to_string order_id) in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) body

let place_order body =
let open Lwt in
let uri = Request.build_uri "/store/order" in
let headers = Request.default_headers in
let body = Request.write_json_body Order.to_yojson body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) ->
Request.read_json_body_as (JsonSupport.unwrap Order.of_yojson) body

16 changes: 8 additions & 8 deletions samples/client/petstore/ocaml-client/src/apis/user_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ let create_user body =
let uri = Request.build_uri "/user" in
let headers = Request.default_headers in
let body = Request.write_json_body User.to_yojson body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) -> return ()

let create_users_with_array_input body =
let open Lwt in
let uri = Request.build_uri "/user/createWithArray" in
let headers = Request.default_headers in
let body = Request.write_json_body (JsonSupport.of_list_of User.to_yojson) body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) -> return ()

let create_users_with_list_input body =
let open Lwt in
let uri = Request.build_uri "/user/createWithList" in
let headers = Request.default_headers in
let body = Request.write_json_body (JsonSupport.of_list_of User.to_yojson) body in
Cohttp_lwt_unix.Client.post uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (_resp, body) -> return ()

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" (username) in
Cohttp_lwt_unix.Client.delete uri ~headers >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (_resp, body) -> return ()

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" (username) in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as (JsonSupport.unwrap User.of_yojson) body

let login_user username password =
Expand All @@ -47,20 +47,20 @@ let login_user username password =
let headers = Request.default_headers in
let uri = Uri.add_query_param' uri ("username", username) in
let uri = Uri.add_query_param' uri ("password", password) in
Cohttp_lwt_unix.Client.get uri ~headers >>= fun (_resp, body) ->
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) ->
Request.read_json_body_as (JsonSupport.to_string) 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.get uri ~headers >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (_resp, body) -> return ()

let update_user username body =
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" (username) in
let body = Request.write_json_body User.to_yojson body in
Cohttp_lwt_unix.Client.put uri ~headers ~body >>= fun (_resp, body) -> return ()
Cohttp_lwt_unix.Client.call `PUT uri ~headers ~body >>= fun (_resp, body) -> return ()