From f79f23865b2cbc16e1a77eb68b473d8d2949be6d Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 21 Apr 2018 23:06:07 +0800 Subject: [PATCH] update clojure petstore with OAS2 (#117) --- .../petstore/clojure/.swagger-codegen/VERSION | 2 +- .../clojure/src/swagger_petstore/api/pet.clj | 52 +++++++---------- .../src/swagger_petstore/api/store.clj | 12 ++-- .../clojure/src/swagger_petstore/api/user.clj | 58 ++++++++----------- 4 files changed, 51 insertions(+), 73 deletions(-) diff --git a/samples/client/petstore/clojure/.swagger-codegen/VERSION b/samples/client/petstore/clojure/.swagger-codegen/VERSION index 855ff9501eb..096bf47efe3 100644 --- a/samples/client/petstore/clojure/.swagger-codegen/VERSION +++ b/samples/client/petstore/clojure/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/clojure/src/swagger_petstore/api/pet.clj b/samples/client/petstore/clojure/src/swagger_petstore/api/pet.clj index c2bdf016c73..ab4152b3132 100644 --- a/samples/client/petstore/clojure/src/swagger_petstore/api/pet.clj +++ b/samples/client/petstore/clojure/src/swagger_petstore/api/pet.clj @@ -3,30 +3,27 @@ (:import (java.io File))) (defn add-pet-with-http-info - "Add a new pet to the store - " + "Add a new pet to the store" ([] (add-pet-with-http-info nil)) - ([{:keys [body ]}] + ([{:keys [pet ]}] (call-api "/pet" :post {:path-params {} :header-params {} :query-params {} :form-params {} - :body-param body + :body-param pet :content-types ["application/json" "application/xml"] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names ["petstore_auth"]}))) (defn add-pet - "Add a new pet to the store - " + "Add a new pet to the store" ([] (add-pet nil)) ([optional-params] (:data (add-pet-with-http-info optional-params)))) (defn delete-pet-with-http-info - "Deletes a pet - " + "Deletes a pet" ([pet-id ] (delete-pet-with-http-info pet-id nil)) ([pet-id {:keys [api-key ]}] (check-required-params pet-id) @@ -36,12 +33,11 @@ :query-params {} :form-params {} :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names ["petstore_auth"]}))) (defn delete-pet - "Deletes a pet - " + "Deletes a pet" ([pet-id ] (delete-pet pet-id nil)) ([pet-id optional-params] (:data (delete-pet-with-http-info pet-id optional-params)))) @@ -54,7 +50,7 @@ (call-api "/pet/findByStatus" :get {:path-params {} :header-params {} - :query-params {"status" (with-collection-format status :multi) } + :query-params {"status" status } :form-params {} :content-types [] :accepts ["application/json" "application/xml"] @@ -75,7 +71,7 @@ (call-api "/pet/findByTags" :get {:path-params {} :header-params {} - :query-params {"tags" (with-collection-format tags :multi) } + :query-params {"tags" tags } :form-params {} :content-types [] :accepts ["application/json" "application/xml"] @@ -109,30 +105,27 @@ (:data (get-pet-by-id-with-http-info pet-id))) (defn update-pet-with-http-info - "Update an existing pet - " + "Update an existing pet" ([] (update-pet-with-http-info nil)) - ([{:keys [body ]}] + ([{:keys [pet ]}] (call-api "/pet" :put {:path-params {} :header-params {} :query-params {} :form-params {} - :body-param body + :body-param pet :content-types ["application/json" "application/xml"] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names ["petstore_auth"]}))) (defn update-pet - "Update an existing pet - " + "Update an existing pet" ([] (update-pet nil)) ([optional-params] (:data (update-pet-with-http-info optional-params)))) (defn update-pet-with-form-with-http-info - "Updates a pet in the store with form data - " + "Updates a pet in the store with form data" ([pet-id ] (update-pet-with-form-with-http-info pet-id nil)) ([pet-id {:keys [name status ]}] (check-required-params pet-id) @@ -142,19 +135,17 @@ :query-params {} :form-params {"name" name "status" status } :content-types ["application/x-www-form-urlencoded"] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names ["petstore_auth"]}))) (defn update-pet-with-form - "Updates a pet in the store with form data - " + "Updates a pet in the store with form data" ([pet-id ] (update-pet-with-form pet-id nil)) ([pet-id optional-params] (:data (update-pet-with-form-with-http-info pet-id optional-params)))) (defn upload-file-with-http-info - "uploads an image - " + "uploads an image" ([pet-id ] (upload-file-with-http-info pet-id nil)) ([pet-id {:keys [additional-metadata ^File file ]}] (check-required-params pet-id) @@ -164,12 +155,11 @@ :query-params {} :form-params {"additionalMetadata" additional-metadata "file" file } :content-types ["multipart/form-data"] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names ["petstore_auth"]}))) (defn upload-file - "uploads an image - " + "uploads an image" ([pet-id ] (upload-file pet-id nil)) ([pet-id optional-params] (:data (upload-file-with-http-info pet-id optional-params)))) diff --git a/samples/client/petstore/clojure/src/swagger_petstore/api/store.clj b/samples/client/petstore/clojure/src/swagger_petstore/api/store.clj index 1a690e4a56c..b001568b2b7 100644 --- a/samples/client/petstore/clojure/src/swagger_petstore/api/store.clj +++ b/samples/client/petstore/clojure/src/swagger_petstore/api/store.clj @@ -13,7 +13,7 @@ :query-params {} :form-params {} :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []})) (defn delete-order @@ -62,23 +62,21 @@ (:data (get-order-by-id-with-http-info order-id))) (defn place-order-with-http-info - "Place an order for a pet - " + "Place an order for a pet" ([] (place-order-with-http-info nil)) - ([{:keys [body ]}] + ([{:keys [order ]}] (call-api "/store/order" :post {:path-params {} :header-params {} :query-params {} :form-params {} - :body-param body + :body-param order :content-types [] :accepts ["application/json" "application/xml"] :auth-names []}))) (defn place-order - "Place an order for a pet - " + "Place an order for a pet" ([] (place-order nil)) ([optional-params] (:data (place-order-with-http-info optional-params)))) diff --git a/samples/client/petstore/clojure/src/swagger_petstore/api/user.clj b/samples/client/petstore/clojure/src/swagger_petstore/api/user.clj index 78fa5463a8b..7cda2927f9b 100644 --- a/samples/client/petstore/clojure/src/swagger_petstore/api/user.clj +++ b/samples/client/petstore/clojure/src/swagger_petstore/api/user.clj @@ -6,15 +6,15 @@ "Create user This can only be done by the logged in user." ([] (create-user-with-http-info nil)) - ([{:keys [body ]}] + ([{:keys [user ]}] (call-api "/user" :post {:path-params {} :header-params {} :query-params {} :form-params {} - :body-param body + :body-param user :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []}))) (defn create-user @@ -25,45 +25,41 @@ (:data (create-user-with-http-info optional-params)))) (defn create-users-with-array-input-with-http-info - "Creates list of users with given input array - " + "Creates list of users with given input array" ([] (create-users-with-array-input-with-http-info nil)) - ([{:keys [body ]}] + ([{:keys [user ]}] (call-api "/user/createWithArray" :post {:path-params {} :header-params {} :query-params {} :form-params {} - :body-param body + :body-param user :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []}))) (defn create-users-with-array-input - "Creates list of users with given input array - " + "Creates list of users with given input array" ([] (create-users-with-array-input nil)) ([optional-params] (:data (create-users-with-array-input-with-http-info optional-params)))) (defn create-users-with-list-input-with-http-info - "Creates list of users with given input array - " + "Creates list of users with given input array" ([] (create-users-with-list-input-with-http-info nil)) - ([{:keys [body ]}] + ([{:keys [user ]}] (call-api "/user/createWithList" :post {:path-params {} :header-params {} :query-params {} :form-params {} - :body-param body + :body-param user :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []}))) (defn create-users-with-list-input - "Creates list of users with given input array - " + "Creates list of users with given input array" ([] (create-users-with-list-input nil)) ([optional-params] (:data (create-users-with-list-input-with-http-info optional-params)))) @@ -79,7 +75,7 @@ :query-params {} :form-params {} :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []})) (defn delete-user @@ -89,8 +85,7 @@ (:data (delete-user-with-http-info username))) (defn get-user-by-name-with-http-info - "Get user by user name - " + "Get user by user name" [username ] (check-required-params username) (call-api "/user/{username}" :get @@ -103,14 +98,12 @@ :auth-names []})) (defn get-user-by-name - "Get user by user name - " + "Get user by user name" [username ] (:data (get-user-by-name-with-http-info username))) (defn login-user-with-http-info - "Logs user into the system - " + "Logs user into the system" ([] (login-user-with-http-info nil)) ([{:keys [username password ]}] (call-api "/user/login" :get @@ -123,15 +116,13 @@ :auth-names []}))) (defn login-user - "Logs user into the system - " + "Logs user into the system" ([] (login-user nil)) ([optional-params] (:data (login-user-with-http-info optional-params)))) (defn logout-user-with-http-info - "Logs out current logged in user session - " + "Logs out current logged in user session" [] (call-api "/user/logout" :get {:path-params {} @@ -139,12 +130,11 @@ :query-params {} :form-params {} :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []})) (defn logout-user - "Logs out current logged in user session - " + "Logs out current logged in user session" [] (:data (logout-user-with-http-info))) @@ -152,16 +142,16 @@ "Updated user This can only be done by the logged in user." ([username ] (update-user-with-http-info username nil)) - ([username {:keys [body ]}] + ([username {:keys [user ]}] (check-required-params username) (call-api "/user/{username}" :put {:path-params {"username" username } :header-params {} :query-params {} :form-params {} - :body-param body + :body-param user :content-types [] - :accepts ["application/json" "application/xml"] + :accepts [] :auth-names []}))) (defn update-user