Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@
(map (fn [[k v]] [k (normalize-param v)]))
(into {})))

(defn default-to-json-mime
"Default to JSON MIME if given */* MIME"
[mime]
(if (= mime "*/*")
"application/json"
mime))

(defn json-mime?
"Check if the given MIME is a standard JSON MIME or :json."
[mime]
Expand All @@ -182,7 +189,7 @@
[mimes]
(-> (filter json-mime? mimes)
first
(or (first mimes))))
(or (default-to-json-mime (first mimes)))))

(defn serialize
"Serialize the given data according to content-type.
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/clojure/git_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined

if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment."
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/clojure/project.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(defproject swagger-petstore "1.0.0"
:description "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters"
:license {:name "Apache 2.0"
:license {:name "Apache-2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[clj-http "3.6.0"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"
([pet-id ] (delete-pet-with-http-info pet-id nil))
([pet-id {:keys [api-key ]}]
(check-required-params pet-id)
(call-api "/pet/{petId}" :delete
{:path-params {"petId" pet-id }
:header-params {"api_key" api-key }
Expand Down Expand Up @@ -91,6 +92,7 @@
"Find pet by ID
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(check-required-params pet-id)
(call-api "/pet/{petId}" :get
{:path-params {"petId" pet-id }
:header-params {}
Expand Down Expand Up @@ -133,6 +135,7 @@
"
([pet-id ] (update-pet-with-form-with-http-info pet-id nil))
([pet-id {:keys [name status ]}]
(check-required-params pet-id)
(call-api "/pet/{petId}" :post
{:path-params {"petId" pet-id }
:header-params {}
Expand All @@ -154,6 +157,7 @@
"
([pet-id ] (upload-file-with-http-info pet-id nil))
([pet-id {:keys [additional-metadata ^File file ]}]
(check-required-params pet-id)
(call-api "/pet/{petId}/uploadImage" :post
{:path-params {"petId" pet-id }
:header-params {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"
[order-id ]
(check-required-params order-id)
(call-api "/store/order/{orderId}" :delete
{:path-params {"orderId" order-id }
:header-params {}
Expand Down Expand Up @@ -44,6 +45,7 @@
"Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions"
[order-id ]
(check-required-params order-id)
(call-api "/store/order/{orderId}" :get
{:path-params {"orderId" order-id }
:header-params {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"Delete user
This can only be done by the logged in user."
[username ]
(check-required-params username)
(call-api "/user/{username}" :delete
{:path-params {"username" username }
:header-params {}
Expand All @@ -91,6 +92,7 @@
"Get user by user name
"
[username ]
(check-required-params username)
(call-api "/user/{username}" :get
{:path-params {"username" username }
:header-params {}
Expand Down Expand Up @@ -151,6 +153,7 @@
This can only be done by the logged in user."
([username ] (update-user-with-http-info username nil))
([username {:keys [body ]}]
(check-required-params username)
(call-api "/user/{username}" :put
{:path-params {"username" username }
:header-params {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@
(map (fn [[k v]] [k (normalize-param v)]))
(into {})))

(defn default-to-json-mime
"Default to JSON MIME if given */* MIME"
[mime]
(if (= mime "*/*")
"application/json"
mime))

(defn json-mime?
"Check if the given MIME is a standard JSON MIME or :json."
[mime]
Expand All @@ -182,7 +189,7 @@
[mimes]
(-> (filter json-mime? mimes)
first
(or (first mimes))))
(or (default-to-json-mime (first mimes)))))

(defn serialize
"Serialize the given data according to content-type.
Expand Down