update clojure petstore samples

This commit is contained in:
William Cheng 2018-10-16 18:06:05 +08:00
parent cfbc72f444
commit e42cac636a
6 changed files with 47 additions and 47 deletions

View File

@ -1 +1 @@
3.0.0-SNAPSHOT
4.0.0-SNAPSHOT

View File

@ -38,12 +38,12 @@
(defn-spec delete-pet-with-http-info any?
"Deletes a pet"
([petId int?, ] (delete-pet-with-http-info petId nil))
([petId int?, {:keys [api_key]} (s/map-of keyword? any?)]
(check-required-params petId)
([pet-id int?, ] (delete-pet-with-http-info pet-id nil))
([pet-id int?, {:keys [api-key]} (s/map-of keyword? any?)]
(check-required-params pet-id)
(call-api "/pet/{petId}" :delete
{:path-params {"petId" petId }
:header-params {"api_key" api_key }
{:path-params {"petId" pet-id }
:header-params {"api_key" api-key }
:query-params {}
:form-params {}
:content-types []
@ -52,9 +52,9 @@
(defn-spec delete-pet any?
"Deletes a pet"
([petId int?, ] (delete-pet petId nil))
([petId int?, optional-params any?]
(let [res (:data (delete-pet-with-http-info petId optional-params))]
([pet-id int?, ] (delete-pet pet-id nil))
([pet-id int?, optional-params any?]
(let [res (:data (delete-pet-with-http-info pet-id optional-params))]
(if (:decode-models *api-context*)
(st/decode any? res st/string-transformer)
res))))
@ -68,7 +68,7 @@
(call-api "/pet/findByStatus" :get
{:path-params {}
:header-params {}
:query-params {"status" (with-collection-format status :csv) }
:query-params {"status" (with-collection-format status :multi) }
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
@ -93,7 +93,7 @@
(call-api "/pet/findByTags" :get
{:path-params {}
:header-params {}
:query-params {"tags" (with-collection-format tags :csv) }
:query-params {"tags" (with-collection-format tags :multi) }
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
@ -113,10 +113,10 @@
(defn-spec get-pet-by-id-with-http-info any?
"Find pet by ID
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[petId int?]
(check-required-params petId)
[pet-id int?]
(check-required-params pet-id)
(call-api "/pet/{petId}" :get
{:path-params {"petId" petId }
{:path-params {"petId" pet-id }
:header-params {}
:query-params {}
:form-params {}
@ -127,8 +127,8 @@
(defn-spec get-pet-by-id pet-spec
"Find pet by ID
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[petId int?]
(let [res (:data (get-pet-by-id-with-http-info petId))]
[pet-id int?]
(let [res (:data (get-pet-by-id-with-http-info pet-id))]
(if (:decode-models *api-context*)
(st/decode pet-spec res st/string-transformer)
res)))
@ -160,11 +160,11 @@
(defn-spec update-pet-with-form-with-http-info any?
"Updates a pet in the store with form data"
([petId string?, ] (update-pet-with-form-with-http-info petId nil))
([petId string?, {:keys [name status]} (s/map-of keyword? any?)]
(check-required-params petId)
([pet-id string?, ] (update-pet-with-form-with-http-info pet-id nil))
([pet-id string?, {:keys [name status]} (s/map-of keyword? any?)]
(check-required-params pet-id)
(call-api "/pet/{petId}" :post
{:path-params {"petId" petId }
{:path-params {"petId" pet-id }
:header-params {}
:query-params {}
:form-params {"name" name "status" status }
@ -174,9 +174,9 @@
(defn-spec update-pet-with-form any?
"Updates a pet in the store with form data"
([petId string?, ] (update-pet-with-form petId nil))
([petId string?, optional-params any?]
(let [res (:data (update-pet-with-form-with-http-info petId optional-params))]
([pet-id string?, ] (update-pet-with-form pet-id nil))
([pet-id string?, optional-params any?]
(let [res (:data (update-pet-with-form-with-http-info pet-id optional-params))]
(if (:decode-models *api-context*)
(st/decode any? res st/string-transformer)
res))))
@ -184,23 +184,23 @@
(defn-spec upload-file-with-http-info any?
"uploads an image"
([petId int?, ] (upload-file-with-http-info petId nil))
([petId int?, {:keys [additionalMetadata ^File file]} (s/map-of keyword? any?)]
(check-required-params petId)
([pet-id int?, ] (upload-file-with-http-info pet-id nil))
([pet-id int?, {:keys [additional-metadata ^File file]} (s/map-of keyword? any?)]
(check-required-params pet-id)
(call-api "/pet/{petId}/uploadImage" :post
{:path-params {"petId" petId }
{:path-params {"petId" pet-id }
:header-params {}
:query-params {}
:form-params {"additionalMetadata" additionalMetadata "file" file }
:form-params {"additionalMetadata" additional-metadata "file" file }
:content-types ["multipart/form-data"]
:accepts []
:auth-names ["petstore_auth"]})))
(defn-spec upload-file any?
"uploads an image"
([petId int?, ] (upload-file petId nil))
([petId int?, optional-params any?]
(let [res (:data (upload-file-with-http-info petId optional-params))]
([pet-id int?, ] (upload-file pet-id nil))
([pet-id int?, optional-params any?]
(let [res (:data (upload-file-with-http-info pet-id optional-params))]
(if (:decode-models *api-context*)
(st/decode any? res st/string-transformer)
res))))

View File

@ -15,10 +15,10 @@
(defn-spec delete-order-with-http-info any?
"Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"
[orderId string?]
(check-required-params orderId)
[order-id string?]
(check-required-params order-id)
(call-api "/store/order/{orderId}" :delete
{:path-params {"orderId" orderId }
{:path-params {"orderId" order-id }
:header-params {}
:query-params {}
:form-params {}
@ -29,8 +29,8 @@
(defn-spec delete-order any?
"Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"
[orderId string?]
(let [res (:data (delete-order-with-http-info orderId))]
[order-id string?]
(let [res (:data (delete-order-with-http-info order-id))]
(if (:decode-models *api-context*)
(st/decode any? res st/string-transformer)
res)))
@ -62,10 +62,10 @@
(defn-spec get-order-by-id-with-http-info any?
"Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions"
[orderId string?]
(check-required-params orderId)
[order-id string?]
(check-required-params order-id)
(call-api "/store/order/{orderId}" :get
{:path-params {"orderId" orderId }
{:path-params {"orderId" order-id }
:header-params {}
:query-params {}
:form-params {}
@ -76,8 +76,8 @@
(defn-spec get-order-by-id order-spec
"Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions"
[orderId string?]
(let [res (:data (get-order-by-id-with-http-info orderId))]
[order-id string?]
(let [res (:data (get-order-by-id-with-http-info order-id))]
(if (:decode-models *api-context*)
(st/decode order-spec res st/string-transformer)
res)))

View File

@ -8,9 +8,9 @@
(def order-data
{
(ds/opt :id) int?
(ds/opt :petId) int?
(ds/opt :pet-id) int?
(ds/opt :quantity) int?
(ds/opt :shipDate) inst?
(ds/opt :ship-date) inst?
(ds/opt :status) string?
(ds/opt :complete) boolean?
})

View File

@ -12,7 +12,7 @@
(ds/opt :id) int?
(ds/opt :category) category-spec
(ds/req :name) string?
(ds/req :photoUrls) (s/coll-of string?)
(ds/req :photo-urls) (s/coll-of string?)
(ds/opt :tags) (s/coll-of tag-spec)
(ds/opt :status) string?
})

View File

@ -9,12 +9,12 @@
{
(ds/opt :id) int?
(ds/opt :username) string?
(ds/opt :firstName) string?
(ds/opt :lastName) string?
(ds/opt :first-name) string?
(ds/opt :last-name) string?
(ds/opt :email) string?
(ds/opt :password) string?
(ds/opt :phone) string?
(ds/opt :userStatus) int?
(ds/opt :user-status) int?
})
(def user-spec