forked from loafle/openapi-generator-original
update php, nodejs, scalatra server for petstore
This commit is contained in:
parent
400cc9e6f9
commit
c93fcc2643
@ -1,23 +1,37 @@
|
|||||||
---
|
---
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
info:
|
info:
|
||||||
description: "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io)\
|
description: "This is a sample server Petstore server. You can find out more about\
|
||||||
\ or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample,\
|
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
|
||||||
\ you can use the api key `special-key` to test the authorization filters\n"
|
\ For this sample, you can use the api key `special-key` to test the authorization\
|
||||||
|
\ filters."
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
title: "Swagger Petstore"
|
title: "Swagger Petstore"
|
||||||
termsOfService: "http://swagger.io/terms/"
|
termsOfService: "http://swagger.io/terms/"
|
||||||
contact:
|
contact:
|
||||||
name: "apiteam@swagger.io"
|
email: "apiteam@swagger.io"
|
||||||
license:
|
license:
|
||||||
name: "Apache 2.0"
|
name: "Apache 2.0"
|
||||||
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
host: "petstore.swagger.io"
|
host: "petstore.swagger.io"
|
||||||
basePath: "/v2"
|
basePath: "/v2"
|
||||||
|
tags:
|
||||||
|
- name: "pet"
|
||||||
|
description: "Everything about your Pets"
|
||||||
|
externalDocs:
|
||||||
|
description: "Find out more"
|
||||||
|
url: "http://swagger.io"
|
||||||
|
- name: "store"
|
||||||
|
description: "Access to Petstore orders"
|
||||||
|
- name: "user"
|
||||||
|
description: "Operations about user"
|
||||||
|
externalDocs:
|
||||||
|
description: "Find out more about our store"
|
||||||
|
url: "http://swagger.io"
|
||||||
schemes:
|
schemes:
|
||||||
- "http"
|
- "http"
|
||||||
paths:
|
paths:
|
||||||
/pets:
|
/pet:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
@ -28,13 +42,13 @@ paths:
|
|||||||
- "application/json"
|
- "application/json"
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Pet object that needs to be added to the store"
|
description: "Pet object that needs to be added to the store"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Pet"
|
$ref: "#/definitions/Pet"
|
||||||
responses:
|
responses:
|
||||||
@ -42,8 +56,8 @@ paths:
|
|||||||
description: "Invalid input"
|
description: "Invalid input"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
put:
|
put:
|
||||||
tags:
|
tags:
|
||||||
@ -55,13 +69,13 @@ paths:
|
|||||||
- "application/json"
|
- "application/json"
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Pet object that needs to be added to the store"
|
description: "Pet object that needs to be added to the store"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Pet"
|
$ref: "#/definitions/Pet"
|
||||||
responses:
|
responses:
|
||||||
@ -73,28 +87,33 @@ paths:
|
|||||||
description: "Validation exception"
|
description: "Validation exception"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
/pets/findByStatus:
|
/pet/findByStatus:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
summary: "Finds Pets by status"
|
summary: "Finds Pets by status"
|
||||||
description: "Multiple status values can be provided with comma seperated strings"
|
description: "Multiple status values can be provided with comma separated strings"
|
||||||
operationId: "findPetsByStatus"
|
operationId: "findPetsByStatus"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "status"
|
- name: "status"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "Status values that need to be considered for filter"
|
description: "Status values that need to be considered for filter"
|
||||||
required: false
|
required: true
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
collectionFormat: "multi"
|
default: "available"
|
||||||
|
enum:
|
||||||
|
- "available"
|
||||||
|
- "pending"
|
||||||
|
- "sold"
|
||||||
|
collectionFormat: "csv"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
@ -106,29 +125,29 @@ paths:
|
|||||||
description: "Invalid status value"
|
description: "Invalid status value"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
/pets/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
summary: "Finds Pets by tags"
|
summary: "Finds Pets by tags"
|
||||||
description: "Muliple tags can be provided with comma seperated strings. Use\
|
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||||
\ tag1, tag2, tag3 for testing."
|
\ tag1, tag2, tag3 for testing."
|
||||||
operationId: "findPetsByTags"
|
operationId: "findPetsByTags"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "tags"
|
- name: "tags"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "Tags to filter by"
|
description: "Tags to filter by"
|
||||||
required: false
|
required: true
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
collectionFormat: "multi"
|
collectionFormat: "csv"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
@ -140,24 +159,23 @@ paths:
|
|||||||
description: "Invalid tag value"
|
description: "Invalid tag value"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
/pets/{petId}:
|
/pet/{petId}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
summary: "Find pet by ID"
|
summary: "Find pet by ID"
|
||||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
description: "Returns a single pet"
|
||||||
\ API error conditions"
|
|
||||||
operationId: "getPetById"
|
operationId: "getPetById"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "petId"
|
- name: "petId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of pet that needs to be fetched"
|
description: "ID of pet to return"
|
||||||
required: true
|
required: true
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
@ -172,9 +190,6 @@ paths:
|
|||||||
description: "Pet not found"
|
description: "Pet not found"
|
||||||
security:
|
security:
|
||||||
- api_key: []
|
- api_key: []
|
||||||
- petstore_auth:
|
|
||||||
- "write_pets"
|
|
||||||
- "read_pets"
|
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@ -185,31 +200,32 @@ paths:
|
|||||||
consumes:
|
consumes:
|
||||||
- "application/x-www-form-urlencoded"
|
- "application/x-www-form-urlencoded"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "petId"
|
- name: "petId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of pet that needs to be updated"
|
description: "ID of pet that needs to be updated"
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
- name: "name"
|
- name: "name"
|
||||||
in: "formData"
|
in: "formData"
|
||||||
description: "Updated name of the pet"
|
description: "Updated name of the pet"
|
||||||
required: true
|
required: false
|
||||||
type: "string"
|
type: "string"
|
||||||
- name: "status"
|
- name: "status"
|
||||||
in: "formData"
|
in: "formData"
|
||||||
description: "Updated status of the pet"
|
description: "Updated status of the pet"
|
||||||
required: true
|
required: false
|
||||||
type: "string"
|
type: "string"
|
||||||
responses:
|
responses:
|
||||||
405:
|
405:
|
||||||
description: "Invalid input"
|
description: "Invalid input"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
@ -218,13 +234,12 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "deletePet"
|
operationId: "deletePet"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "api_key"
|
- name: "api_key"
|
||||||
in: "header"
|
in: "header"
|
||||||
description: ""
|
required: false
|
||||||
required: true
|
|
||||||
type: "string"
|
type: "string"
|
||||||
- name: "petId"
|
- name: "petId"
|
||||||
in: "path"
|
in: "path"
|
||||||
@ -237,10 +252,69 @@ paths:
|
|||||||
description: "Invalid pet value"
|
description: "Invalid pet value"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
x-swagger-router-controller: "Pet"
|
x-swagger-router-controller: "Pet"
|
||||||
/stores/order:
|
/pet/{petId}/uploadImage:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- "pet"
|
||||||
|
summary: "uploads an image"
|
||||||
|
description: ""
|
||||||
|
operationId: "uploadFile"
|
||||||
|
consumes:
|
||||||
|
- "multipart/form-data"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters:
|
||||||
|
- name: "petId"
|
||||||
|
in: "path"
|
||||||
|
description: "ID of pet to update"
|
||||||
|
required: true
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
- name: "additionalMetadata"
|
||||||
|
in: "formData"
|
||||||
|
description: "Additional data to pass to server"
|
||||||
|
required: false
|
||||||
|
type: "string"
|
||||||
|
- name: "file"
|
||||||
|
in: "formData"
|
||||||
|
description: "file to upload"
|
||||||
|
required: false
|
||||||
|
type: "file"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "successful operation"
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/ApiResponse"
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- "write:pets"
|
||||||
|
- "read:pets"
|
||||||
|
x-swagger-router-controller: "Pet"
|
||||||
|
/store/inventory:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- "store"
|
||||||
|
summary: "Returns pet inventories by status"
|
||||||
|
description: "Returns a map of status codes to quantities"
|
||||||
|
operationId: "getInventory"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "successful operation"
|
||||||
|
schema:
|
||||||
|
type: "object"
|
||||||
|
additionalProperties:
|
||||||
|
type: "integer"
|
||||||
|
format: "int32"
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
x-swagger-router-controller: "Store"
|
||||||
|
/store/order:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "store"
|
- "store"
|
||||||
@ -248,13 +322,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "placeOrder"
|
operationId: "placeOrder"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "order placed for purchasing the pet"
|
description: "order placed for purchasing the pet"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Order"
|
$ref: "#/definitions/Order"
|
||||||
responses:
|
responses:
|
||||||
@ -265,7 +339,7 @@ paths:
|
|||||||
400:
|
400:
|
||||||
description: "Invalid Order"
|
description: "Invalid Order"
|
||||||
x-swagger-router-controller: "Store"
|
x-swagger-router-controller: "Store"
|
||||||
/stores/order/{orderId}:
|
/store/order/{orderId}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "store"
|
- "store"
|
||||||
@ -274,14 +348,17 @@ paths:
|
|||||||
\ values will generated exceptions"
|
\ values will generated exceptions"
|
||||||
operationId: "getOrderById"
|
operationId: "getOrderById"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "orderId"
|
- name: "orderId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of pet that needs to be fetched"
|
description: "ID of pet that needs to be fetched"
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "integer"
|
||||||
|
maximum: 5
|
||||||
|
minimum: 1
|
||||||
|
format: "int64"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
@ -300,21 +377,22 @@ paths:
|
|||||||
\ above 1000 or nonintegers will generate API errors"
|
\ above 1000 or nonintegers will generate API errors"
|
||||||
operationId: "deleteOrder"
|
operationId: "deleteOrder"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "orderId"
|
- name: "orderId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of the order that needs to be deleted"
|
description: "ID of the order that needs to be deleted"
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
|
minimum: 1
|
||||||
responses:
|
responses:
|
||||||
400:
|
400:
|
||||||
description: "Invalid ID supplied"
|
description: "Invalid ID supplied"
|
||||||
404:
|
404:
|
||||||
description: "Order not found"
|
description: "Order not found"
|
||||||
x-swagger-router-controller: "Store"
|
x-swagger-router-controller: "Store"
|
||||||
/users:
|
/user:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -322,20 +400,20 @@ paths:
|
|||||||
description: "This can only be done by the logged in user."
|
description: "This can only be done by the logged in user."
|
||||||
operationId: "createUser"
|
operationId: "createUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Created user object"
|
description: "Created user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
x-swagger-router-controller: "User"
|
x-swagger-router-controller: "User"
|
||||||
/users/createWithArray:
|
/user/createWithArray:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -343,13 +421,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "createUsersWithArrayInput"
|
operationId: "createUsersWithArrayInput"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "List of user object"
|
description: "List of user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
@ -358,7 +436,7 @@ paths:
|
|||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
x-swagger-router-controller: "User"
|
x-swagger-router-controller: "User"
|
||||||
/users/createWithList:
|
/user/createWithList:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -366,13 +444,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "createUsersWithListInput"
|
operationId: "createUsersWithListInput"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "List of user object"
|
description: "List of user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
@ -381,7 +459,7 @@ paths:
|
|||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
x-swagger-router-controller: "User"
|
x-swagger-router-controller: "User"
|
||||||
/users/login:
|
/user/login:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -389,28 +467,37 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "loginUser"
|
operationId: "loginUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "The user name for login"
|
description: "The user name for login"
|
||||||
required: false
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
- name: "password"
|
- name: "password"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "The password for login in clear text"
|
description: "The password for login in clear text"
|
||||||
required: false
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
schema:
|
schema:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
headers:
|
||||||
|
X-Rate-Limit:
|
||||||
|
type: "integer"
|
||||||
|
format: "int32"
|
||||||
|
description: "calls per hour allowed by the user"
|
||||||
|
X-Expires-After:
|
||||||
|
type: "string"
|
||||||
|
format: "date-time"
|
||||||
|
description: "date in UTC when toekn expires"
|
||||||
400:
|
400:
|
||||||
description: "Invalid username/password supplied"
|
description: "Invalid username/password supplied"
|
||||||
x-swagger-router-controller: "User"
|
x-swagger-router-controller: "User"
|
||||||
/users/logout:
|
/user/logout:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -418,14 +505,14 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "logoutUser"
|
operationId: "logoutUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters: []
|
parameters: []
|
||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
x-swagger-router-controller: "User"
|
x-swagger-router-controller: "User"
|
||||||
/users/{username}:
|
/user/{username}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -433,12 +520,12 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "getUserByName"
|
operationId: "getUserByName"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "The name that needs to be fetched. Use user1 for testing."
|
description: "The name that needs to be fetched. Use user1 for testing. "
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
responses:
|
responses:
|
||||||
@ -458,8 +545,8 @@ paths:
|
|||||||
description: "This can only be done by the logged in user."
|
description: "This can only be done by the logged in user."
|
||||||
operationId: "updateUser"
|
operationId: "updateUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "path"
|
in: "path"
|
||||||
@ -469,7 +556,7 @@ paths:
|
|||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Updated user object"
|
description: "Updated user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
responses:
|
responses:
|
||||||
@ -485,8 +572,8 @@ paths:
|
|||||||
description: "This can only be done by the logged in user."
|
description: "This can only be done by the logged in user."
|
||||||
operationId: "deleteUser"
|
operationId: "deleteUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "path"
|
in: "path"
|
||||||
@ -509,9 +596,46 @@ securityDefinitions:
|
|||||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||||
flow: "implicit"
|
flow: "implicit"
|
||||||
scopes:
|
scopes:
|
||||||
write_pets: "modify pets in your account"
|
write:pets: "modify pets in your account"
|
||||||
read_pets: "read your pets"
|
read:pets: "read your pets"
|
||||||
definitions:
|
definitions:
|
||||||
|
Order:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
petId:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
quantity:
|
||||||
|
type: "integer"
|
||||||
|
format: "int32"
|
||||||
|
shipDate:
|
||||||
|
type: "string"
|
||||||
|
format: "date-time"
|
||||||
|
status:
|
||||||
|
type: "string"
|
||||||
|
description: "Order Status"
|
||||||
|
enum:
|
||||||
|
- "placed"
|
||||||
|
- "approved"
|
||||||
|
- "delivered"
|
||||||
|
complete:
|
||||||
|
type: "boolean"
|
||||||
|
default: false
|
||||||
|
xml:
|
||||||
|
name: "Order"
|
||||||
|
Category:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
name:
|
||||||
|
type: "string"
|
||||||
|
xml:
|
||||||
|
name: "Category"
|
||||||
User:
|
User:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
@ -534,7 +658,9 @@ definitions:
|
|||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int32"
|
format: "int32"
|
||||||
description: "User Status"
|
description: "User Status"
|
||||||
Category:
|
xml:
|
||||||
|
name: "User"
|
||||||
|
Tag:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
@ -542,6 +668,8 @@ definitions:
|
|||||||
format: "int64"
|
format: "int64"
|
||||||
name:
|
name:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
xml:
|
||||||
|
name: "Tag"
|
||||||
Pet:
|
Pet:
|
||||||
type: "object"
|
type: "object"
|
||||||
required:
|
required:
|
||||||
@ -558,40 +686,37 @@ definitions:
|
|||||||
example: "doggie"
|
example: "doggie"
|
||||||
photoUrls:
|
photoUrls:
|
||||||
type: "array"
|
type: "array"
|
||||||
|
xml:
|
||||||
|
name: "photoUrl"
|
||||||
|
wrapped: true
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
tags:
|
tags:
|
||||||
type: "array"
|
type: "array"
|
||||||
|
xml:
|
||||||
|
name: "tag"
|
||||||
|
wrapped: true
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/Tag"
|
$ref: "#/definitions/Tag"
|
||||||
status:
|
status:
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "pet status in the store"
|
description: "pet status in the store"
|
||||||
Tag:
|
enum:
|
||||||
|
- "available"
|
||||||
|
- "pending"
|
||||||
|
- "sold"
|
||||||
|
xml:
|
||||||
|
name: "Pet"
|
||||||
|
ApiResponse:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
id:
|
code:
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
name:
|
|
||||||
type: "string"
|
|
||||||
Order:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
petId:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
quantity:
|
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int32"
|
format: "int32"
|
||||||
shipDate:
|
type:
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "date-time"
|
message:
|
||||||
status:
|
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "Order Status"
|
externalDocs:
|
||||||
complete:
|
description: "Find out more about Swagger"
|
||||||
type: "boolean"
|
url: "http://swagger.io"
|
||||||
|
@ -33,3 +33,7 @@ module.exports.updatePet = function updatePet (req, res, next) {
|
|||||||
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
|
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
|
||||||
Pet.updatePetWithForm(req.swagger.params, res, next);
|
Pet.updatePetWithForm(req.swagger.params, res, next);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.uploadFile = function uploadFile (req, res, next) {
|
||||||
|
Pet.uploadFile(req.swagger.params, res, next);
|
||||||
|
};
|
||||||
|
@ -12,8 +12,8 @@ exports.addPet = function(args, res, next) {
|
|||||||
exports.deletePet = function(args, res, next) {
|
exports.deletePet = function(args, res, next) {
|
||||||
/**
|
/**
|
||||||
* parameters expected in the args:
|
* parameters expected in the args:
|
||||||
* apiKey (String)
|
|
||||||
* petId (Long)
|
* petId (Long)
|
||||||
|
* apiKey (String)
|
||||||
**/
|
**/
|
||||||
// no response value expected for this operation
|
// no response value expected for this operation
|
||||||
res.end();
|
res.end();
|
||||||
@ -121,7 +121,7 @@ exports.updatePet = function(args, res, next) {
|
|||||||
exports.updatePetWithForm = function(args, res, next) {
|
exports.updatePetWithForm = function(args, res, next) {
|
||||||
/**
|
/**
|
||||||
* parameters expected in the args:
|
* parameters expected in the args:
|
||||||
* petId (String)
|
* petId (Long)
|
||||||
* name (String)
|
* name (String)
|
||||||
* status (String)
|
* status (String)
|
||||||
**/
|
**/
|
||||||
@ -129,3 +129,26 @@ exports.updatePetWithForm = function(args, res, next) {
|
|||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.uploadFile = function(args, res, next) {
|
||||||
|
/**
|
||||||
|
* parameters expected in the args:
|
||||||
|
* petId (Long)
|
||||||
|
* additionalMetadata (String)
|
||||||
|
* file (file)
|
||||||
|
**/
|
||||||
|
var examples = {};
|
||||||
|
examples['application/json'] = {
|
||||||
|
"message" : "aeiou",
|
||||||
|
"code" : 123,
|
||||||
|
"type" : "aeiou"
|
||||||
|
};
|
||||||
|
if(Object.keys(examples).length > 0) {
|
||||||
|
res.setHeader('Content-Type', 'application/json');
|
||||||
|
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,10 @@ module.exports.deleteOrder = function deleteOrder (req, res, next) {
|
|||||||
Store.deleteOrder(req.swagger.params, res, next);
|
Store.deleteOrder(req.swagger.params, res, next);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.getInventory = function getInventory (req, res, next) {
|
||||||
|
Store.getInventory(req.swagger.params, res, next);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.getOrderById = function getOrderById (req, res, next) {
|
module.exports.getOrderById = function getOrderById (req, res, next) {
|
||||||
Store.getOrderById(req.swagger.params, res, next);
|
Store.getOrderById(req.swagger.params, res, next);
|
||||||
};
|
};
|
||||||
|
@ -9,10 +9,28 @@ exports.deleteOrder = function(args, res, next) {
|
|||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.getInventory = function(args, res, next) {
|
||||||
|
/**
|
||||||
|
* parameters expected in the args:
|
||||||
|
**/
|
||||||
|
var examples = {};
|
||||||
|
examples['application/json'] = {
|
||||||
|
"key" : 123
|
||||||
|
};
|
||||||
|
if(Object.keys(examples).length > 0) {
|
||||||
|
res.setHeader('Content-Type', 'application/json');
|
||||||
|
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
exports.getOrderById = function(args, res, next) {
|
exports.getOrderById = function(args, res, next) {
|
||||||
/**
|
/**
|
||||||
* parameters expected in the args:
|
* parameters expected in the args:
|
||||||
* orderId (String)
|
* orderId (Long)
|
||||||
**/
|
**/
|
||||||
var examples = {};
|
var examples = {};
|
||||||
examples['application/json'] = {
|
examples['application/json'] = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "swagger-petstore",
|
"name": "swagger-petstore",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample, you can use the api key `special-key` to test the authorization filters\n",
|
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"swagger"
|
"swagger"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
|
||||||
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||||
is an example of building a swagger-enabled scalatra server.
|
is an example of building a swagger-enabled scalatra server.
|
||||||
|
|
||||||
This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
|
This example uses the [scalatra](http://scalatra.org/) framework. To see how to make this your own, look here:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import com.wordnik.client.api._
|
import com.wordnik.client.api._
|
||||||
import akka.actor.ActorSystem
|
import akka.actor.ActorSystem
|
||||||
import io.swagger.app.{ResourcesApp, SwaggerApp}
|
import io.swagger.app.{ ResourcesApp, SwaggerApp }
|
||||||
import javax.servlet.ServletContext
|
import javax.servlet.ServletContext
|
||||||
import org.scalatra.LifeCycle
|
import org.scalatra.LifeCycle
|
||||||
|
|
||||||
@ -10,9 +10,9 @@ class ScalatraBootstrap extends LifeCycle {
|
|||||||
override def init(context: ServletContext) {
|
override def init(context: ServletContext) {
|
||||||
implicit val system = ActorSystem("appActorSystem")
|
implicit val system = ActorSystem("appActorSystem")
|
||||||
try {
|
try {
|
||||||
context mount (new UserApi, "/User/*")
|
|
||||||
context mount (new PetApi, "/Pet/*")
|
context mount (new PetApi, "/Pet/*")
|
||||||
context mount (new StoreApi, "/Store/*")
|
context mount (new StoreApi, "/Store/*")
|
||||||
|
context mount (new UserApi, "/User/*")
|
||||||
|
|
||||||
context mount (new ResourcesApp, "/api-docs/*")
|
context mount (new ResourcesApp, "/api-docs/*")
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -3,26 +3,26 @@ package io.swagger.app
|
|||||||
import _root_.akka.actor.ActorSystem
|
import _root_.akka.actor.ActorSystem
|
||||||
|
|
||||||
import org.scalatra.swagger.{ ApiInfo, SwaggerWithAuth, Swagger }
|
import org.scalatra.swagger.{ ApiInfo, SwaggerWithAuth, Swagger }
|
||||||
import org.scalatra.swagger.{JacksonSwaggerBase, Swagger}
|
import org.scalatra.swagger.{ JacksonSwaggerBase, Swagger }
|
||||||
import org.scalatra.ScalatraServlet
|
import org.scalatra.ScalatraServlet
|
||||||
import org.json4s.{DefaultFormats, Formats}
|
import org.json4s.{ DefaultFormats, Formats }
|
||||||
|
|
||||||
class ResourcesApp(implicit protected val system: ActorSystem, val swagger: SwaggerApp)
|
class ResourcesApp(implicit protected val system: ActorSystem, val swagger: SwaggerApp)
|
||||||
extends ScalatraServlet with JacksonSwaggerBase {
|
extends ScalatraServlet with JacksonSwaggerBase {
|
||||||
before() {
|
before() {
|
||||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
protected def buildFullUrl(path: String) = if (path.startsWith("http")) path else {
|
protected def buildFullUrl(path: String) = if (path.startsWith("http")) path else {
|
||||||
val port = request.getServerPort
|
val port = request.getServerPort
|
||||||
val h = request.getServerName
|
val h = request.getServerName
|
||||||
val prot = if (port == 443) "https" else "http"
|
val prot = if (port == 443) "https" else "http"
|
||||||
val (proto, host) = if (port != 80 && port != 443) ("http", h+":"+port.toString) else (prot, h)
|
val (proto, host) = if (port != 80 && port != 443) ("http", h + ":" + port.toString) else (prot, h)
|
||||||
"%s://%s%s%s".format(
|
"%s://%s%s%s".format(
|
||||||
proto,
|
proto,
|
||||||
host,
|
host,
|
||||||
request.getContextPath,
|
request.getContextPath,
|
||||||
path)
|
path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ class SwaggerApp extends Swagger(apiInfo = ApiSwagger.apiInfo, apiVersion = "1.0
|
|||||||
object ApiSwagger {
|
object ApiSwagger {
|
||||||
val apiInfo = ApiInfo(
|
val apiInfo = ApiInfo(
|
||||||
"""Swagger Petstore""",
|
"""Swagger Petstore""",
|
||||||
"""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""",
|
"""This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.""",
|
||||||
"""""",
|
"""""",
|
||||||
"""apiteam@swagger.io""",
|
"""apiteam@swagger.io""",
|
||||||
"""Apache 2.0""",
|
"""Apache 2.0""",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.wordnik.client.api
|
package com.wordnik.client.api
|
||||||
|
|
||||||
import com.wordnik.client.model.Pet
|
import com.wordnik.client.model.Pet
|
||||||
|
import com.wordnik.client.model.ApiResponse
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -29,156 +30,16 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val updatePetOperation = (apiOperation[Unit]("updatePet")
|
|
||||||
summary "Update an existing pet"
|
|
||||||
parameters(bodyParam[Pet]("body").description("").optional)
|
|
||||||
)
|
|
||||||
|
|
||||||
put("/pet",operation(updatePetOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bodyParam[Pet]("body").description("").optional
|
|
||||||
|
|
||||||
println("body: " + body)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val addPetOperation = (apiOperation[Unit]("addPet")
|
val addPetOperation = (apiOperation[Unit]("addPet")
|
||||||
summary "Add a new pet to the store"
|
summary "Add a new pet to the store"
|
||||||
parameters(bodyParam[Pet]("body").description("").optional)
|
parameters(bodyParam[Pet]("body").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
post("/pet",operation(addPetOperation)) {
|
post("/pet",operation(addPetOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
bodyParam[Pet]("body").description("")
|
||||||
|
|
||||||
bodyParam[Pet]("body").description("").optional
|
|
||||||
|
|
||||||
println("body: " + body)
|
println("body: " + body)
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val findPetsByStatusOperation = (apiOperation[List[Pet]]("findPetsByStatus")
|
|
||||||
summary "Finds Pets by status"
|
|
||||||
parameters(queryParam[List[String]]("status").description("").optional.defaultValue(available))
|
|
||||||
)
|
|
||||||
|
|
||||||
get("/pet/findByStatus",operation(findPetsByStatusOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val statusString = params.getAs[String]("status")
|
|
||||||
val status = if("multi".equals("default")) {
|
|
||||||
statusString match {
|
|
||||||
case Some(str) => str.split(",")
|
|
||||||
case None => List()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
List()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("status: " + status)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val findPetsByTagsOperation = (apiOperation[List[Pet]]("findPetsByTags")
|
|
||||||
summary "Finds Pets by tags"
|
|
||||||
parameters(queryParam[List[String]]("tags").description("").optional)
|
|
||||||
)
|
|
||||||
|
|
||||||
get("/pet/findByTags",operation(findPetsByTagsOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val tagsString = params.getAs[String]("tags")
|
|
||||||
val tags = if("multi".equals("default")) {
|
|
||||||
tagsString match {
|
|
||||||
case Some(str) => str.split(",")
|
|
||||||
case None => List()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
List()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("tags: " + tags)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val getPetByIdOperation = (apiOperation[Pet]("getPetById")
|
|
||||||
summary "Find pet by ID"
|
|
||||||
parameters(pathParam[Long]("petId").description(""))
|
|
||||||
)
|
|
||||||
|
|
||||||
get("/pet/{petId}",operation(getPetByIdOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val petId = params.getOrElse("petId", halt(400))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("petId: " + petId)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val updatePetWithFormOperation = (apiOperation[Unit]("updatePetWithForm")
|
|
||||||
summary "Updates a pet in the store with form data"
|
|
||||||
parameters(pathParam[String]("petId").description(""),
|
|
||||||
formParam[String]("name").description("").optional,
|
|
||||||
formParam[String]("status").description("").optional)
|
|
||||||
)
|
|
||||||
|
|
||||||
post("/pet/{petId}",operation(updatePetWithFormOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val petId = params.getOrElse("petId", halt(400))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("petId: " + petId)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val name = params.getAs[String]("name")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("name: " + name)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val status = params.getAs[String]("status")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("status: " + status)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -192,27 +53,123 @@ bodyParam[Pet]("body").description("").optional
|
|||||||
delete("/pet/{petId}",operation(deletePetOperation)) {
|
delete("/pet/{petId}",operation(deletePetOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val petId = params.getOrElse("petId", halt(400))
|
val petId = params.getOrElse("petId", halt(400))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("petId: " + petId)
|
println("petId: " + petId)
|
||||||
|
|
||||||
|
|
||||||
|
val apiKey = request.getHeader("apiKey")
|
||||||
|
|
||||||
val apiKey = request.getHeader("apiKey")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("apiKey: " + apiKey)
|
println("apiKey: " + apiKey)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val uploadFileOperation = (apiOperation[Unit]("uploadFile")
|
val findPetsByStatusOperation = (apiOperation[List[Pet]]("findPetsByStatus")
|
||||||
|
summary "Finds Pets by status"
|
||||||
|
parameters(queryParam[List[String]]("status").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
get("/pet/findByStatus",operation(findPetsByStatusOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
val statusString = params.getAs[String]("status")
|
||||||
|
val status = if("csv".equals("default")) {
|
||||||
|
statusString match {
|
||||||
|
case Some(str) => str.split(",")
|
||||||
|
case None => List()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
List()
|
||||||
|
|
||||||
|
|
||||||
|
println("status: " + status)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val findPetsByTagsOperation = (apiOperation[List[Pet]]("findPetsByTags")
|
||||||
|
summary "Finds Pets by tags"
|
||||||
|
parameters(queryParam[List[String]]("tags").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
get("/pet/findByTags",operation(findPetsByTagsOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
val tagsString = params.getAs[String]("tags")
|
||||||
|
val tags = if("csv".equals("default")) {
|
||||||
|
tagsString match {
|
||||||
|
case Some(str) => str.split(",")
|
||||||
|
case None => List()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
List()
|
||||||
|
|
||||||
|
|
||||||
|
println("tags: " + tags)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val getPetByIdOperation = (apiOperation[Pet]("getPetById")
|
||||||
|
summary "Find pet by ID"
|
||||||
|
parameters(pathParam[Long]("petId").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
get("/pet/{petId}",operation(getPetByIdOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
val petId = params.getOrElse("petId", halt(400))
|
||||||
|
|
||||||
|
println("petId: " + petId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val updatePetOperation = (apiOperation[Unit]("updatePet")
|
||||||
|
summary "Update an existing pet"
|
||||||
|
parameters(bodyParam[Pet]("body").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
put("/pet",operation(updatePetOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
bodyParam[Pet]("body").description("")
|
||||||
|
println("body: " + body)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val updatePetWithFormOperation = (apiOperation[Unit]("updatePetWithForm")
|
||||||
|
summary "Updates a pet in the store with form data"
|
||||||
|
parameters(pathParam[Long]("petId").description(""),
|
||||||
|
formParam[String]("name").description("").optional,
|
||||||
|
formParam[String]("status").description("").optional)
|
||||||
|
)
|
||||||
|
|
||||||
|
post("/pet/{petId}",operation(updatePetWithFormOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
val petId = params.getOrElse("petId", halt(400))
|
||||||
|
|
||||||
|
println("petId: " + petId)
|
||||||
|
|
||||||
|
|
||||||
|
val name = params.getAs[String]("name")
|
||||||
|
|
||||||
|
println("name: " + name)
|
||||||
|
|
||||||
|
|
||||||
|
val status = params.getAs[String]("status")
|
||||||
|
|
||||||
|
println("status: " + status)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val uploadFileOperation = (apiOperation[ApiResponse]("uploadFile")
|
||||||
summary "uploads an image"
|
summary "uploads an image"
|
||||||
parameters(pathParam[Long]("petId").description(""),
|
parameters(pathParam[Long]("petId").description(""),
|
||||||
formParam[String]("additionalMetadata").description("").optional,
|
formParam[String]("additionalMetadata").description("").optional,
|
||||||
@ -222,26 +179,16 @@ bodyParam[Pet]("body").description("").optional
|
|||||||
post("/pet/{petId}/uploadImage",operation(uploadFileOperation)) {
|
post("/pet/{petId}/uploadImage",operation(uploadFileOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val petId = params.getOrElse("petId", halt(400))
|
val petId = params.getOrElse("petId", halt(400))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("petId: " + petId)
|
println("petId: " + petId)
|
||||||
|
|
||||||
|
|
||||||
|
val additionalMetadata = params.getAs[String]("additionalMetadata")
|
||||||
|
|
||||||
val additionalMetadata = params.getAs[String]("additionalMetadata")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("additionalMetadata: " + additionalMetadata)
|
println("additionalMetadata: " + additionalMetadata)
|
||||||
|
|
||||||
val file = fileParams("file")
|
val file = fileParams("file")
|
||||||
|
println("file: " + file)
|
||||||
println("file: " + file)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,11 +9,11 @@ import org.scalatra.swagger._
|
|||||||
import org.json4s._
|
import org.json4s._
|
||||||
import org.json4s.JsonDSL._
|
import org.json4s.JsonDSL._
|
||||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
import org.scalatra.servlet.{ FileUploadSupport, MultipartConfig, SizeConstraintExceededException }
|
||||||
|
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
|
|
||||||
class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
class StoreApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||||
with FileUploadSupport
|
with FileUploadSupport
|
||||||
with JacksonJsonSupport
|
with JacksonJsonSupport
|
||||||
with SwaggerSupport {
|
with SwaggerSupport {
|
||||||
@ -27,70 +27,47 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
||||||
|
summary "Delete purchase order by ID"
|
||||||
|
parameters (pathParam[String]("orderId").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
delete("/store/order/{orderId}", operation(deleteOrderOperation)) {
|
||||||
|
|
||||||
|
val orderId = params.getOrElse("orderId", halt(400))
|
||||||
|
|
||||||
|
println("orderId: " + orderId)
|
||||||
|
}
|
||||||
|
|
||||||
val getInventoryOperation = (apiOperation[Map[String, Int]]("getInventory")
|
val getInventoryOperation = (apiOperation[Map[String, Int]]("getInventory")
|
||||||
summary "Returns pet inventories by status"
|
summary "Returns pet inventories by status"
|
||||||
parameters()
|
parameters ()
|
||||||
)
|
)
|
||||||
|
|
||||||
get("/store/inventory",operation(getInventoryOperation)) {
|
get("/store/inventory", operation(getInventoryOperation)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val placeOrderOperation = (apiOperation[Order]("placeOrder")
|
|
||||||
summary "Place an order for a pet"
|
|
||||||
parameters(bodyParam[Order]("body").description("").optional)
|
|
||||||
)
|
|
||||||
|
|
||||||
post("/store/order",operation(placeOrderOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bodyParam[Order]("body").description("").optional
|
|
||||||
|
|
||||||
println("body: " + body)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val getOrderByIdOperation = (apiOperation[Order]("getOrderById")
|
val getOrderByIdOperation = (apiOperation[Order]("getOrderById")
|
||||||
summary "Find purchase order by ID"
|
summary "Find purchase order by ID"
|
||||||
parameters(pathParam[String]("orderId").description(""))
|
parameters (pathParam[Long]("orderId").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
get("/store/order/{orderId}",operation(getOrderByIdOperation)) {
|
get("/store/order/{orderId}", operation(getOrderByIdOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val orderId = params.getOrElse("orderId", halt(400))
|
|
||||||
|
|
||||||
|
|
||||||
|
val orderId = params.getOrElse("orderId", halt(400))
|
||||||
|
|
||||||
println("orderId: " + orderId)
|
println("orderId: " + orderId)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val placeOrderOperation = (apiOperation[Order]("placeOrder")
|
||||||
|
summary "Place an order for a pet"
|
||||||
val deleteOrderOperation = (apiOperation[Unit]("deleteOrder")
|
parameters (bodyParam[Order]("body").description(""))
|
||||||
summary "Delete purchase order by ID"
|
|
||||||
parameters(pathParam[String]("orderId").description(""))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
delete("/store/order/{orderId}",operation(deleteOrderOperation)) {
|
post("/store/order", operation(placeOrderOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val orderId = params.getOrElse("orderId", halt(400))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("orderId: " + orderId)
|
|
||||||
|
|
||||||
|
bodyParam[Order]("body").description("")
|
||||||
|
println("body: " + body)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,11 +9,11 @@ import org.scalatra.swagger._
|
|||||||
import org.json4s._
|
import org.json4s._
|
||||||
import org.json4s.JsonDSL._
|
import org.json4s.JsonDSL._
|
||||||
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
import org.scalatra.json.{ JValueResult, JacksonJsonSupport }
|
||||||
import org.scalatra.servlet.{FileUploadSupport, MultipartConfig, SizeConstraintExceededException}
|
import org.scalatra.servlet.{ FileUploadSupport, MultipartConfig, SizeConstraintExceededException }
|
||||||
|
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
|
|
||||||
class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
class UserApi(implicit val swagger: Swagger) extends ScalatraServlet
|
||||||
with FileUploadSupport
|
with FileUploadSupport
|
||||||
with JacksonJsonSupport
|
with JacksonJsonSupport
|
||||||
with SwaggerSupport {
|
with SwaggerSupport {
|
||||||
@ -27,165 +27,102 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet
|
|||||||
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
response.headers += ("Access-Control-Allow-Origin" -> "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val createUserOperation = (apiOperation[Unit]("createUser")
|
val createUserOperation = (apiOperation[Unit]("createUser")
|
||||||
summary "Create user"
|
summary "Create user"
|
||||||
parameters(bodyParam[User]("body").description("").optional)
|
parameters (bodyParam[User]("body").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
post("/user",operation(createUserOperation)) {
|
post("/user", operation(createUserOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bodyParam[User]("body").description("").optional
|
|
||||||
|
|
||||||
|
bodyParam[User]("body").description("")
|
||||||
println("body: " + body)
|
println("body: " + body)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val createUsersWithArrayInputOperation = (apiOperation[Unit]("createUsersWithArrayInput")
|
val createUsersWithArrayInputOperation = (apiOperation[Unit]("createUsersWithArrayInput")
|
||||||
summary "Creates list of users with given input array"
|
summary "Creates list of users with given input array"
|
||||||
parameters(bodyParam[List[User]]("body").description("").optional)
|
parameters (bodyParam[List[User]]("body").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
post("/user/createWithArray",operation(createUsersWithArrayInputOperation)) {
|
post("/user/createWithArray", operation(createUsersWithArrayInputOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bodyParam[List[User]]("body").description("").optional
|
|
||||||
|
|
||||||
|
bodyParam[List[User]]("body").description("")
|
||||||
println("body: " + body)
|
println("body: " + body)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val createUsersWithListInputOperation = (apiOperation[Unit]("createUsersWithListInput")
|
val createUsersWithListInputOperation = (apiOperation[Unit]("createUsersWithListInput")
|
||||||
summary "Creates list of users with given input array"
|
summary "Creates list of users with given input array"
|
||||||
parameters(bodyParam[List[User]]("body").description("").optional)
|
parameters (bodyParam[List[User]]("body").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
post("/user/createWithList",operation(createUsersWithListInputOperation)) {
|
post("/user/createWithList", operation(createUsersWithListInputOperation)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bodyParam[List[User]]("body").description("").optional
|
|
||||||
|
|
||||||
|
bodyParam[List[User]]("body").description("")
|
||||||
println("body: " + body)
|
println("body: " + body)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val loginUserOperation = (apiOperation[String]("loginUser")
|
|
||||||
summary "Logs user into the system"
|
|
||||||
parameters(queryParam[String]("username").description("").optional,
|
|
||||||
queryParam[String]("password").description("").optional)
|
|
||||||
)
|
|
||||||
|
|
||||||
get("/user/login",operation(loginUserOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val username = params.getAs[String]("username")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("username: " + username)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val password = params.getAs[String]("password")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("password: " + password)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val logoutUserOperation = (apiOperation[Unit]("logoutUser")
|
|
||||||
summary "Logs out current logged in user session"
|
|
||||||
parameters()
|
|
||||||
)
|
|
||||||
|
|
||||||
get("/user/logout",operation(logoutUserOperation)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val getUserByNameOperation = (apiOperation[User]("getUserByName")
|
|
||||||
summary "Get user by user name"
|
|
||||||
parameters(pathParam[String]("username").description(""))
|
|
||||||
)
|
|
||||||
|
|
||||||
get("/user/{username}",operation(getUserByNameOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val username = params.getOrElse("username", halt(400))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("username: " + username)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val updateUserOperation = (apiOperation[Unit]("updateUser")
|
|
||||||
summary "Updated user"
|
|
||||||
parameters(pathParam[String]("username").description(""),
|
|
||||||
bodyParam[User]("body").description("").optional)
|
|
||||||
)
|
|
||||||
|
|
||||||
put("/user/{username}",operation(updateUserOperation)) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val username = params.getOrElse("username", halt(400))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
println("username: " + username)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bodyParam[User]("body").description("").optional
|
|
||||||
|
|
||||||
println("body: " + body)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val deleteUserOperation = (apiOperation[Unit]("deleteUser")
|
val deleteUserOperation = (apiOperation[Unit]("deleteUser")
|
||||||
summary "Delete user"
|
summary "Delete user"
|
||||||
parameters(pathParam[String]("username").description(""))
|
parameters (pathParam[String]("username").description(""))
|
||||||
)
|
)
|
||||||
|
|
||||||
delete("/user/{username}",operation(deleteUserOperation)) {
|
delete("/user/{username}", operation(deleteUserOperation)) {
|
||||||
|
|
||||||
|
val username = params.getOrElse("username", halt(400))
|
||||||
|
|
||||||
|
println("username: " + username)
|
||||||
|
}
|
||||||
|
|
||||||
val username = params.getOrElse("username", halt(400))
|
val getUserByNameOperation = (apiOperation[User]("getUserByName")
|
||||||
|
summary "Get user by user name"
|
||||||
|
parameters (pathParam[String]("username").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
get("/user/{username}", operation(getUserByNameOperation)) {
|
||||||
|
|
||||||
|
val username = params.getOrElse("username", halt(400))
|
||||||
|
|
||||||
|
println("username: " + username)
|
||||||
|
}
|
||||||
|
|
||||||
|
val loginUserOperation = (apiOperation[String]("loginUser")
|
||||||
|
summary "Logs user into the system"
|
||||||
|
parameters (queryParam[String]("username").description(""),
|
||||||
|
queryParam[String]("password").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
get("/user/login", operation(loginUserOperation)) {
|
||||||
|
|
||||||
|
val username = params.getAs[String]("username")
|
||||||
|
|
||||||
println("username: " + username)
|
println("username: " + username)
|
||||||
|
|
||||||
|
val password = params.getAs[String]("password")
|
||||||
|
|
||||||
|
println("password: " + password)
|
||||||
|
}
|
||||||
|
|
||||||
|
val logoutUserOperation = (apiOperation[Unit]("logoutUser")
|
||||||
|
summary "Logs out current logged in user session"
|
||||||
|
parameters ()
|
||||||
|
)
|
||||||
|
|
||||||
|
get("/user/logout", operation(logoutUserOperation)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
val updateUserOperation = (apiOperation[Unit]("updateUser")
|
||||||
|
summary "Updated user"
|
||||||
|
parameters (pathParam[String]("username").description(""),
|
||||||
|
bodyParam[User]("body").description(""))
|
||||||
|
)
|
||||||
|
|
||||||
|
put("/user/{username}", operation(updateUserOperation)) {
|
||||||
|
|
||||||
|
val username = params.getOrElse("username", halt(400))
|
||||||
|
|
||||||
|
println("username: " + username)
|
||||||
|
|
||||||
|
bodyParam[User]("body").description("")
|
||||||
|
println("body: " + body)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,5 @@
|
|||||||
package com.wordnik.client.model
|
package com.wordnik.client.model
|
||||||
|
|
||||||
|
case class Category(
|
||||||
|
id: Option[Long],
|
||||||
case class Category (
|
name: Option[String])
|
||||||
id: Long,
|
|
||||||
name: String
|
|
||||||
)
|
|
||||||
|
@ -2,12 +2,10 @@ package com.wordnik.client.model
|
|||||||
|
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
|
case class Order(
|
||||||
case class Order (
|
id: Option[Long],
|
||||||
id: Long,
|
petId: Option[Long],
|
||||||
petId: Long,
|
quantity: Option[Int],
|
||||||
quantity: Int,
|
shipDate: Option[Date],
|
||||||
shipDate: Date,
|
status: Option[String], // Order Status
|
||||||
status: String,
|
complete: Option[Boolean])
|
||||||
complete: Boolean
|
|
||||||
)
|
|
||||||
|
@ -3,12 +3,11 @@ package com.wordnik.client.model
|
|||||||
import com.wordnik.client.model.Category
|
import com.wordnik.client.model.Category
|
||||||
import com.wordnik.client.model.Tag
|
import com.wordnik.client.model.Tag
|
||||||
|
|
||||||
|
case class Pet(
|
||||||
case class Pet (
|
id: Option[Long],
|
||||||
id: Long,
|
category: Option[Category],
|
||||||
category: Category,
|
|
||||||
name: String,
|
name: String,
|
||||||
photoUrls: List[String],
|
photoUrls: List[String],
|
||||||
tags: List[Tag],
|
tags: Option[List[Tag]],
|
||||||
status: String
|
status: Option[String] // pet status in the store
|
||||||
)
|
)
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.wordnik.client.model
|
package com.wordnik.client.model
|
||||||
|
|
||||||
|
case class Tag(
|
||||||
|
id: Option[Long],
|
||||||
case class Tag (
|
name: Option[String])
|
||||||
id: Long,
|
|
||||||
name: String
|
|
||||||
)
|
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package com.wordnik.client.model
|
package com.wordnik.client.model
|
||||||
|
|
||||||
|
case class User(
|
||||||
|
id: Option[Long],
|
||||||
case class User (
|
username: Option[String],
|
||||||
id: Long,
|
firstName: Option[String],
|
||||||
username: String,
|
lastName: Option[String],
|
||||||
firstName: String,
|
email: Option[String],
|
||||||
lastName: String,
|
password: Option[String],
|
||||||
email: String,
|
phone: Option[String],
|
||||||
password: String,
|
userStatus: Option[Int] // User Status
|
||||||
phone: String,
|
)
|
||||||
userStatus: Int
|
|
||||||
)
|
|
||||||
|
@ -8,85 +8,6 @@ use Silex\Application;
|
|||||||
$app = new Silex\Application();
|
$app = new Silex\Application();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/user', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing createUser as a POST method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/user/createWithArray', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing createUsersWithArrayInput as a POST method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/user/createWithList', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing createUsersWithListInput as a POST method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/user/login', function(Application $app, Request $request) {
|
|
||||||
$username = $request->get('username'); $password = $request->get('password');
|
|
||||||
|
|
||||||
return new Response('How about implementing loginUser as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/user/logout', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing logoutUser as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/user/{username}', function(Application $app, Request $request, $username) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing getUserByName as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->PUT('/user/{username}', function(Application $app, Request $request, $username) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing updateUser as a PUT method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->DELETE('/user/{username}', function(Application $app, Request $request, $username) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing deleteUser as a DELETE method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->PUT('/pet', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing updatePet as a PUT method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/pet', function(Application $app, Request $request) {
|
$app->POST('/pet', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
@ -94,39 +15,6 @@ $app->POST('/pet', function(Application $app, Request $request) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/pet/findByStatus', function(Application $app, Request $request) {
|
|
||||||
$status = $request->get('status');
|
|
||||||
|
|
||||||
return new Response('How about implementing findPetsByStatus as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/pet/findByTags', function(Application $app, Request $request) {
|
|
||||||
$tags = $request->get('tags');
|
|
||||||
|
|
||||||
return new Response('How about implementing findPetsByTags as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing getPetById as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
|
||||||
|
|
||||||
$name = $request->get('name'); $status = $request->get('status');
|
|
||||||
return new Response('How about implementing updatePetWithForm as a POST method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->DELETE('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
$app->DELETE('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||||
|
|
||||||
|
|
||||||
@ -134,6 +22,40 @@ $app->DELETE('/pet/{petId}', function(Application $app, Request $request, $pet_i
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/pet/findByStatus', function(Application $app, Request $request) {
|
||||||
|
$status = $request->get('status');
|
||||||
|
|
||||||
|
return new Response('How about implementing findPetsByStatus as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/pet/findByTags', function(Application $app, Request $request) {
|
||||||
|
$tags = $request->get('tags');
|
||||||
|
|
||||||
|
return new Response('How about implementing findPetsByTags as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing getPetById as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->PUT('/pet', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing updatePet as a PUT method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->POST('/pet/{petId}', function(Application $app, Request $request, $pet_id) {
|
||||||
|
|
||||||
|
$name = $request->get('name'); $status = $request->get('status');
|
||||||
|
return new Response('How about implementing updatePetWithForm as a POST method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/pet/{petId}/uploadImage', function(Application $app, Request $request, $pet_id) {
|
$app->POST('/pet/{petId}/uploadImage', function(Application $app, Request $request, $pet_id) {
|
||||||
|
|
||||||
@ -142,51 +64,6 @@ $app->POST('/pet/{petId}/uploadImage', function(Application $app, Request $reque
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/pet/{petId}?testing_byte_array=true', function(Application $app, Request $request, $pet_id) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing getPetByIdWithByteArray as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/pet?testing_byte_array=true', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing addPetUsingByteArray as a POST method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/store/inventory', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing getInventory as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->POST('/store/order', function(Application $app, Request $request) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing placeOrder as a POST method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->GET('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
|
||||||
|
|
||||||
|
|
||||||
return new Response('How about implementing getOrderById as a GET method ?');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->DELETE('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
$app->DELETE('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +71,81 @@ $app->DELETE('/store/order/{orderId}', function(Application $app, Request $reque
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/store/inventory', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing getInventory as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/store/order/{orderId}', function(Application $app, Request $request, $order_id) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing getOrderById as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->POST('/store/order', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing placeOrder as a POST method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->POST('/user', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing createUser as a POST method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->POST('/user/createWithArray', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing createUsersWithArrayInput as a POST method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->POST('/user/createWithList', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing createUsersWithListInput as a POST method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->DELETE('/user/{username}', function(Application $app, Request $request, $username) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing deleteUser as a DELETE method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/user/{username}', function(Application $app, Request $request, $username) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing getUserByName as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/user/login', function(Application $app, Request $request) {
|
||||||
|
$username = $request->get('username'); $password = $request->get('password');
|
||||||
|
|
||||||
|
return new Response('How about implementing loginUser as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->GET('/user/logout', function(Application $app, Request $request) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing logoutUser as a GET method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$app->PUT('/user/{username}', function(Application $app, Request $request, $username) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Response('How about implementing updateUser as a PUT method ?');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
||||||
|
@ -1,25 +1,20 @@
|
|||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('POST', '/v2/pets', {
|
MyApp.add_route('POST', '/v2/pet', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Add a new pet to the store",
|
"summary" => "Add a new pet to the store",
|
||||||
"nickname" => "add_pet",
|
"nickname" => "add_pet",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/pets",
|
"endpoint" => "/pet",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "Pet object that needs to be added to the store",
|
"description" => "Pet object that needs to be added to the store",
|
||||||
"dataType" => "Pet",
|
"dataType" => "Pet",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -28,32 +23,26 @@ MyApp.add_route('POST', '/v2/pets', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('DELETE', '/v2/pets/{petId}', {
|
MyApp.add_route('DELETE', '/v2/pet/{petId}', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Deletes a pet",
|
"summary" => "Deletes a pet",
|
||||||
"nickname" => "delete_pet",
|
"nickname" => "delete_pet",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/pets/{petId}",
|
"endpoint" => "/pet/{petId}",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "pet_id",
|
"name" => "pet_id",
|
||||||
"description" => "Pet id to delete",
|
"description" => "Pet id to delete",
|
||||||
"dataType" => "int",
|
"dataType" => "int",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "api_key",
|
"name" => "api_key",
|
||||||
"description" => "",
|
"description" => "",
|
||||||
"dataType" => "string",
|
"dataType" => "string",
|
||||||
"paramType" => "header",
|
"paramType" => "header",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -62,28 +51,23 @@ MyApp.add_route('DELETE', '/v2/pets/{petId}', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/pets/findByStatus', {
|
MyApp.add_route('GET', '/v2/pet/findByStatus', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Finds Pets by status",
|
"summary" => "Finds Pets by status",
|
||||||
"nickname" => "find_pets_by_status",
|
"nickname" => "find_pets_by_status",
|
||||||
"responseClass" => "array[Pet]",
|
"responseClass" => "array[Pet]",
|
||||||
"endpoint" => "/pets/findByStatus",
|
"endpoint" => "/pet/findByStatus",
|
||||||
"notes" => "Multiple status values can be provided with comma seperated strings",
|
"notes" => "Multiple status values can be provided with comma separated strings",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "status",
|
"name" => "status",
|
||||||
"description" => "Status values that need to be considered for filter",
|
"description" => "Status values that need to be considered for filter",
|
||||||
"dataType" => "array[string]",
|
"dataType" => "array[string]",
|
||||||
"paramType" => "query",
|
"paramType" => "query",
|
||||||
"collectionFormat" => "multi",
|
"collectionFormat" => "csv",
|
||||||
"allowableValues" => "",
|
"allowableValues" => "",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -92,28 +76,23 @@ MyApp.add_route('GET', '/v2/pets/findByStatus', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/pets/findByTags', {
|
MyApp.add_route('GET', '/v2/pet/findByTags', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Finds Pets by tags",
|
"summary" => "Finds Pets by tags",
|
||||||
"nickname" => "find_pets_by_tags",
|
"nickname" => "find_pets_by_tags",
|
||||||
"responseClass" => "array[Pet]",
|
"responseClass" => "array[Pet]",
|
||||||
"endpoint" => "/pets/findByTags",
|
"endpoint" => "/pet/findByTags",
|
||||||
"notes" => "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
|
"notes" => "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "tags",
|
"name" => "tags",
|
||||||
"description" => "Tags to filter by",
|
"description" => "Tags to filter by",
|
||||||
"dataType" => "array[string]",
|
"dataType" => "array[string]",
|
||||||
"paramType" => "query",
|
"paramType" => "query",
|
||||||
"collectionFormat" => "multi",
|
"collectionFormat" => "csv",
|
||||||
"allowableValues" => "",
|
"allowableValues" => "",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -122,25 +101,20 @@ MyApp.add_route('GET', '/v2/pets/findByTags', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/pets/{petId}', {
|
MyApp.add_route('GET', '/v2/pet/{petId}', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Find pet by ID",
|
"summary" => "Find pet by ID",
|
||||||
"nickname" => "get_pet_by_id",
|
"nickname" => "get_pet_by_id",
|
||||||
"responseClass" => "Pet",
|
"responseClass" => "Pet",
|
||||||
"endpoint" => "/pets/{petId}",
|
"endpoint" => "/pet/{petId}",
|
||||||
"notes" => "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
|
"notes" => "Returns a single pet",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "pet_id",
|
"name" => "pet_id",
|
||||||
"description" => "ID of pet that needs to be fetched",
|
"description" => "ID of pet to return",
|
||||||
"dataType" => "int",
|
"dataType" => "int",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -149,25 +123,20 @@ MyApp.add_route('GET', '/v2/pets/{petId}', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('PUT', '/v2/pets', {
|
MyApp.add_route('PUT', '/v2/pet', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Update an existing pet",
|
"summary" => "Update an existing pet",
|
||||||
"nickname" => "update_pet",
|
"nickname" => "update_pet",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/pets",
|
"endpoint" => "/pet",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "Pet object that needs to be added to the store",
|
"description" => "Pet object that needs to be added to the store",
|
||||||
"dataType" => "Pet",
|
"dataType" => "Pet",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -176,25 +145,42 @@ MyApp.add_route('PUT', '/v2/pets', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('POST', '/v2/pets/{petId}', {
|
MyApp.add_route('POST', '/v2/pet/{petId}', {
|
||||||
"resourcePath" => "/Pet",
|
"resourcePath" => "/Pet",
|
||||||
"summary" => "Updates a pet in the store with form data",
|
"summary" => "Updates a pet in the store with form data",
|
||||||
"nickname" => "update_pet_with_form",
|
"nickname" => "update_pet_with_form",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/pets/{petId}",
|
"endpoint" => "/pet/{petId}",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "pet_id",
|
"name" => "pet_id",
|
||||||
"description" => "ID of pet that needs to be updated",
|
"description" => "ID of pet that needs to be updated",
|
||||||
"dataType" => "string",
|
"dataType" => "int",
|
||||||
|
"paramType" => "path",
|
||||||
|
},
|
||||||
|
]}) do
|
||||||
|
cross_origin
|
||||||
|
# the guts live here
|
||||||
|
|
||||||
|
{"message" => "yes, it worked"}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
MyApp.add_route('POST', '/v2/pet/{petId}/uploadImage', {
|
||||||
|
"resourcePath" => "/Pet",
|
||||||
|
"summary" => "uploads an image",
|
||||||
|
"nickname" => "upload_file",
|
||||||
|
"responseClass" => "ApiResponse",
|
||||||
|
"endpoint" => "/pet/{petId}/uploadImage",
|
||||||
|
"notes" => "",
|
||||||
|
"parameters" => [
|
||||||
|
{
|
||||||
|
"name" => "pet_id",
|
||||||
|
"description" => "ID of pet to update",
|
||||||
|
"dataType" => "int",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
|
@ -1,25 +1,20 @@
|
|||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('DELETE', '/v2/stores/order/{orderId}', {
|
MyApp.add_route('DELETE', '/v2/store/order/{orderId}', {
|
||||||
"resourcePath" => "/Store",
|
"resourcePath" => "/Store",
|
||||||
"summary" => "Delete purchase order by ID",
|
"summary" => "Delete purchase order by ID",
|
||||||
"nickname" => "delete_order",
|
"nickname" => "delete_order",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/stores/order/{orderId}",
|
"endpoint" => "/store/order/{orderId}",
|
||||||
"notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
"notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "order_id",
|
"name" => "order_id",
|
||||||
"description" => "ID of the order that needs to be deleted",
|
"description" => "ID of the order that needs to be deleted",
|
||||||
"dataType" => "string",
|
"dataType" => "string",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -28,25 +23,36 @@ MyApp.add_route('DELETE', '/v2/stores/order/{orderId}', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/stores/order/{orderId}', {
|
MyApp.add_route('GET', '/v2/store/inventory', {
|
||||||
|
"resourcePath" => "/Store",
|
||||||
|
"summary" => "Returns pet inventories by status",
|
||||||
|
"nickname" => "get_inventory",
|
||||||
|
"responseClass" => "map[string,int]",
|
||||||
|
"endpoint" => "/store/inventory",
|
||||||
|
"notes" => "Returns a map of status codes to quantities",
|
||||||
|
"parameters" => [
|
||||||
|
]}) do
|
||||||
|
cross_origin
|
||||||
|
# the guts live here
|
||||||
|
|
||||||
|
{"message" => "yes, it worked"}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
MyApp.add_route('GET', '/v2/store/order/{orderId}', {
|
||||||
"resourcePath" => "/Store",
|
"resourcePath" => "/Store",
|
||||||
"summary" => "Find purchase order by ID",
|
"summary" => "Find purchase order by ID",
|
||||||
"nickname" => "get_order_by_id",
|
"nickname" => "get_order_by_id",
|
||||||
"responseClass" => "Order",
|
"responseClass" => "Order",
|
||||||
"endpoint" => "/stores/order/{orderId}",
|
"endpoint" => "/store/order/{orderId}",
|
||||||
"notes" => "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
"notes" => "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "order_id",
|
"name" => "order_id",
|
||||||
"description" => "ID of pet that needs to be fetched",
|
"description" => "ID of pet that needs to be fetched",
|
||||||
"dataType" => "string",
|
"dataType" => "int",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -55,25 +61,20 @@ MyApp.add_route('GET', '/v2/stores/order/{orderId}', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('POST', '/v2/stores/order', {
|
MyApp.add_route('POST', '/v2/store/order', {
|
||||||
"resourcePath" => "/Store",
|
"resourcePath" => "/Store",
|
||||||
"summary" => "Place an order for a pet",
|
"summary" => "Place an order for a pet",
|
||||||
"nickname" => "place_order",
|
"nickname" => "place_order",
|
||||||
"responseClass" => "Order",
|
"responseClass" => "Order",
|
||||||
"endpoint" => "/stores/order",
|
"endpoint" => "/store/order",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "order placed for purchasing the pet",
|
"description" => "order placed for purchasing the pet",
|
||||||
"dataType" => "Order",
|
"dataType" => "Order",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
|
@ -1,25 +1,20 @@
|
|||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('POST', '/v2/users', {
|
MyApp.add_route('POST', '/v2/user', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Create user",
|
"summary" => "Create user",
|
||||||
"nickname" => "create_user",
|
"nickname" => "create_user",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/users",
|
"endpoint" => "/user",
|
||||||
"notes" => "This can only be done by the logged in user.",
|
"notes" => "This can only be done by the logged in user.",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "Created user object",
|
"description" => "Created user object",
|
||||||
"dataType" => "User",
|
"dataType" => "User",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -28,25 +23,20 @@ MyApp.add_route('POST', '/v2/users', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('POST', '/v2/users/createWithArray', {
|
MyApp.add_route('POST', '/v2/user/createWithArray', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Creates list of users with given input array",
|
"summary" => "Creates list of users with given input array",
|
||||||
"nickname" => "create_users_with_array_input",
|
"nickname" => "create_users_with_array_input",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/users/createWithArray",
|
"endpoint" => "/user/createWithArray",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "List of user object",
|
"description" => "List of user object",
|
||||||
"dataType" => "array[User]",
|
"dataType" => "array[User]",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -55,25 +45,20 @@ MyApp.add_route('POST', '/v2/users/createWithArray', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('POST', '/v2/users/createWithList', {
|
MyApp.add_route('POST', '/v2/user/createWithList', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Creates list of users with given input array",
|
"summary" => "Creates list of users with given input array",
|
||||||
"nickname" => "create_users_with_list_input",
|
"nickname" => "create_users_with_list_input",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/users/createWithList",
|
"endpoint" => "/user/createWithList",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "List of user object",
|
"description" => "List of user object",
|
||||||
"dataType" => "array[User]",
|
"dataType" => "array[User]",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -82,25 +67,20 @@ MyApp.add_route('POST', '/v2/users/createWithList', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('DELETE', '/v2/users/{username}', {
|
MyApp.add_route('DELETE', '/v2/user/{username}', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Delete user",
|
"summary" => "Delete user",
|
||||||
"nickname" => "delete_user",
|
"nickname" => "delete_user",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/users/{username}",
|
"endpoint" => "/user/{username}",
|
||||||
"notes" => "This can only be done by the logged in user.",
|
"notes" => "This can only be done by the logged in user.",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "username",
|
"name" => "username",
|
||||||
"description" => "The name that needs to be deleted",
|
"description" => "The name that needs to be deleted",
|
||||||
"dataType" => "string",
|
"dataType" => "string",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -109,25 +89,20 @@ MyApp.add_route('DELETE', '/v2/users/{username}', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/users/{username}', {
|
MyApp.add_route('GET', '/v2/user/{username}', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Get user by user name",
|
"summary" => "Get user by user name",
|
||||||
"nickname" => "get_user_by_name",
|
"nickname" => "get_user_by_name",
|
||||||
"responseClass" => "User",
|
"responseClass" => "User",
|
||||||
"endpoint" => "/users/{username}",
|
"endpoint" => "/user/{username}",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "username",
|
"name" => "username",
|
||||||
"description" => "The name that needs to be fetched. Use user1 for testing.",
|
"description" => "The name that needs to be fetched. Use user1 for testing. ",
|
||||||
"dataType" => "string",
|
"dataType" => "string",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -136,15 +111,14 @@ MyApp.add_route('GET', '/v2/users/{username}', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/users/login', {
|
MyApp.add_route('GET', '/v2/user/login', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Logs user into the system",
|
"summary" => "Logs user into the system",
|
||||||
"nickname" => "login_user",
|
"nickname" => "login_user",
|
||||||
"responseClass" => "string",
|
"responseClass" => "string",
|
||||||
"endpoint" => "/users/login",
|
"endpoint" => "/user/login",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "username",
|
"name" => "username",
|
||||||
"description" => "The user name for login",
|
"description" => "The user name for login",
|
||||||
@ -154,7 +128,6 @@ MyApp.add_route('GET', '/v2/users/login', {
|
|||||||
"allowableValues" => "",
|
"allowableValues" => "",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "password",
|
"name" => "password",
|
||||||
"description" => "The password for login in clear text",
|
"description" => "The password for login in clear text",
|
||||||
@ -164,10 +137,6 @@ MyApp.add_route('GET', '/v2/users/login', {
|
|||||||
"allowableValues" => "",
|
"allowableValues" => "",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -176,18 +145,14 @@ MyApp.add_route('GET', '/v2/users/login', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('GET', '/v2/users/logout', {
|
MyApp.add_route('GET', '/v2/user/logout', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Logs out current logged in user session",
|
"summary" => "Logs out current logged in user session",
|
||||||
"nickname" => "logout_user",
|
"nickname" => "logout_user",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/users/logout",
|
"endpoint" => "/user/logout",
|
||||||
"notes" => "",
|
"notes" => "",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
@ -196,32 +161,26 @@ MyApp.add_route('GET', '/v2/users/logout', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
MyApp.add_route('PUT', '/v2/users/{username}', {
|
MyApp.add_route('PUT', '/v2/user/{username}', {
|
||||||
"resourcePath" => "/User",
|
"resourcePath" => "/User",
|
||||||
"summary" => "Updated user",
|
"summary" => "Updated user",
|
||||||
"nickname" => "update_user",
|
"nickname" => "update_user",
|
||||||
"responseClass" => "void",
|
"responseClass" => "void",
|
||||||
"endpoint" => "/users/{username}",
|
"endpoint" => "/user/{username}",
|
||||||
"notes" => "This can only be done by the logged in user.",
|
"notes" => "This can only be done by the logged in user.",
|
||||||
"parameters" => [
|
"parameters" => [
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "username",
|
"name" => "username",
|
||||||
"description" => "name that need to be deleted",
|
"description" => "name that need to be deleted",
|
||||||
"dataType" => "string",
|
"dataType" => "string",
|
||||||
"paramType" => "path",
|
"paramType" => "path",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"name" => "body",
|
"name" => "body",
|
||||||
"description" => "Updated user object",
|
"description" => "Updated user object",
|
||||||
"dataType" => "User",
|
"dataType" => "User",
|
||||||
"paramType" => "body",
|
"paramType" => "body",
|
||||||
}
|
}
|
||||||
|
|
||||||
]}) do
|
]}) do
|
||||||
cross_origin
|
cross_origin
|
||||||
# the guts live here
|
# the guts live here
|
||||||
|
@ -1,23 +1,37 @@
|
|||||||
---
|
---
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
info:
|
info:
|
||||||
description: "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io)\
|
description: "This is a sample server Petstore server. You can find out more about\
|
||||||
\ or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample,\
|
\ Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\
|
||||||
\ you can use the api key `special-key` to test the authorization filters\n"
|
\ For this sample, you can use the api key `special-key` to test the authorization\
|
||||||
|
\ filters."
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
title: "Swagger Petstore"
|
title: "Swagger Petstore"
|
||||||
termsOfService: "http://helloreverb.com/terms/"
|
termsOfService: "http://swagger.io/terms/"
|
||||||
contact:
|
contact:
|
||||||
name: "apiteam@swagger.io"
|
email: "apiteam@swagger.io"
|
||||||
license:
|
license:
|
||||||
name: "Apache 2.0"
|
name: "Apache 2.0"
|
||||||
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
host: "petstore.swagger.io"
|
host: "petstore.swagger.io"
|
||||||
basePath: "/v2"
|
basePath: "/v2"
|
||||||
|
tags:
|
||||||
|
- name: "pet"
|
||||||
|
description: "Everything about your Pets"
|
||||||
|
externalDocs:
|
||||||
|
description: "Find out more"
|
||||||
|
url: "http://swagger.io"
|
||||||
|
- name: "store"
|
||||||
|
description: "Access to Petstore orders"
|
||||||
|
- name: "user"
|
||||||
|
description: "Operations about user"
|
||||||
|
externalDocs:
|
||||||
|
description: "Find out more about our store"
|
||||||
|
url: "http://swagger.io"
|
||||||
schemes:
|
schemes:
|
||||||
- "http"
|
- "http"
|
||||||
paths:
|
paths:
|
||||||
/pets:
|
/pet:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
@ -28,13 +42,13 @@ paths:
|
|||||||
- "application/json"
|
- "application/json"
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Pet object that needs to be added to the store"
|
description: "Pet object that needs to be added to the store"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Pet"
|
$ref: "#/definitions/Pet"
|
||||||
responses:
|
responses:
|
||||||
@ -42,8 +56,8 @@ paths:
|
|||||||
description: "Invalid input"
|
description: "Invalid input"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
put:
|
put:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
@ -54,13 +68,13 @@ paths:
|
|||||||
- "application/json"
|
- "application/json"
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Pet object that needs to be added to the store"
|
description: "Pet object that needs to be added to the store"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Pet"
|
$ref: "#/definitions/Pet"
|
||||||
responses:
|
responses:
|
||||||
@ -72,27 +86,32 @@ paths:
|
|||||||
description: "Validation exception"
|
description: "Validation exception"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
/pets/findByStatus:
|
/pet/findByStatus:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
summary: "Finds Pets by status"
|
summary: "Finds Pets by status"
|
||||||
description: "Multiple status values can be provided with comma seperated strings"
|
description: "Multiple status values can be provided with comma separated strings"
|
||||||
operationId: "findPetsByStatus"
|
operationId: "findPetsByStatus"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "status"
|
- name: "status"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "Status values that need to be considered for filter"
|
description: "Status values that need to be considered for filter"
|
||||||
required: false
|
required: true
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
collectionFormat: "multi"
|
default: "available"
|
||||||
|
enum:
|
||||||
|
- "available"
|
||||||
|
- "pending"
|
||||||
|
- "sold"
|
||||||
|
collectionFormat: "csv"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
@ -104,28 +123,28 @@ paths:
|
|||||||
description: "Invalid status value"
|
description: "Invalid status value"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
/pets/findByTags:
|
/pet/findByTags:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
summary: "Finds Pets by tags"
|
summary: "Finds Pets by tags"
|
||||||
description: "Muliple tags can be provided with comma seperated strings. Use\
|
description: "Multiple tags can be provided with comma separated strings. Use\
|
||||||
\ tag1, tag2, tag3 for testing."
|
\ tag1, tag2, tag3 for testing."
|
||||||
operationId: "findPetsByTags"
|
operationId: "findPetsByTags"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "tags"
|
- name: "tags"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "Tags to filter by"
|
description: "Tags to filter by"
|
||||||
required: false
|
required: true
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
collectionFormat: "multi"
|
collectionFormat: "csv"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
@ -137,23 +156,22 @@ paths:
|
|||||||
description: "Invalid tag value"
|
description: "Invalid tag value"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
/pets/{petId}:
|
/pet/{petId}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
summary: "Find pet by ID"
|
summary: "Find pet by ID"
|
||||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
description: "Returns a single pet"
|
||||||
\ API error conditions"
|
|
||||||
operationId: "getPetById"
|
operationId: "getPetById"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "petId"
|
- name: "petId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of pet that needs to be fetched"
|
description: "ID of pet to return"
|
||||||
required: true
|
required: true
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int64"
|
format: "int64"
|
||||||
@ -168,9 +186,6 @@ paths:
|
|||||||
description: "Pet not found"
|
description: "Pet not found"
|
||||||
security:
|
security:
|
||||||
- api_key: []
|
- api_key: []
|
||||||
- petstore_auth:
|
|
||||||
- "write_pets"
|
|
||||||
- "read_pets"
|
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
@ -180,31 +195,32 @@ paths:
|
|||||||
consumes:
|
consumes:
|
||||||
- "application/x-www-form-urlencoded"
|
- "application/x-www-form-urlencoded"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "petId"
|
- name: "petId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of pet that needs to be updated"
|
description: "ID of pet that needs to be updated"
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
- name: "name"
|
- name: "name"
|
||||||
in: "formData"
|
in: "formData"
|
||||||
description: "Updated name of the pet"
|
description: "Updated name of the pet"
|
||||||
required: true
|
required: false
|
||||||
type: "string"
|
type: "string"
|
||||||
- name: "status"
|
- name: "status"
|
||||||
in: "formData"
|
in: "formData"
|
||||||
description: "Updated status of the pet"
|
description: "Updated status of the pet"
|
||||||
required: true
|
required: false
|
||||||
type: "string"
|
type: "string"
|
||||||
responses:
|
responses:
|
||||||
405:
|
405:
|
||||||
description: "Invalid input"
|
description: "Invalid input"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
- "pet"
|
- "pet"
|
||||||
@ -212,13 +228,12 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "deletePet"
|
operationId: "deletePet"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "api_key"
|
- name: "api_key"
|
||||||
in: "header"
|
in: "header"
|
||||||
description: ""
|
required: false
|
||||||
required: true
|
|
||||||
type: "string"
|
type: "string"
|
||||||
- name: "petId"
|
- name: "petId"
|
||||||
in: "path"
|
in: "path"
|
||||||
@ -231,9 +246,66 @@ paths:
|
|||||||
description: "Invalid pet value"
|
description: "Invalid pet value"
|
||||||
security:
|
security:
|
||||||
- petstore_auth:
|
- petstore_auth:
|
||||||
- "write_pets"
|
- "write:pets"
|
||||||
- "read_pets"
|
- "read:pets"
|
||||||
/stores/order:
|
/pet/{petId}/uploadImage:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- "pet"
|
||||||
|
summary: "uploads an image"
|
||||||
|
description: ""
|
||||||
|
operationId: "uploadFile"
|
||||||
|
consumes:
|
||||||
|
- "multipart/form-data"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters:
|
||||||
|
- name: "petId"
|
||||||
|
in: "path"
|
||||||
|
description: "ID of pet to update"
|
||||||
|
required: true
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
- name: "additionalMetadata"
|
||||||
|
in: "formData"
|
||||||
|
description: "Additional data to pass to server"
|
||||||
|
required: false
|
||||||
|
type: "string"
|
||||||
|
- name: "file"
|
||||||
|
in: "formData"
|
||||||
|
description: "file to upload"
|
||||||
|
required: false
|
||||||
|
type: "file"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "successful operation"
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/ApiResponse"
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- "write:pets"
|
||||||
|
- "read:pets"
|
||||||
|
/store/inventory:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- "store"
|
||||||
|
summary: "Returns pet inventories by status"
|
||||||
|
description: "Returns a map of status codes to quantities"
|
||||||
|
operationId: "getInventory"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "successful operation"
|
||||||
|
schema:
|
||||||
|
type: "object"
|
||||||
|
additionalProperties:
|
||||||
|
type: "integer"
|
||||||
|
format: "int32"
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
/store/order:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "store"
|
- "store"
|
||||||
@ -241,13 +313,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "placeOrder"
|
operationId: "placeOrder"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "order placed for purchasing the pet"
|
description: "order placed for purchasing the pet"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Order"
|
$ref: "#/definitions/Order"
|
||||||
responses:
|
responses:
|
||||||
@ -257,7 +329,7 @@ paths:
|
|||||||
$ref: "#/definitions/Order"
|
$ref: "#/definitions/Order"
|
||||||
400:
|
400:
|
||||||
description: "Invalid Order"
|
description: "Invalid Order"
|
||||||
/stores/order/{orderId}:
|
/store/order/{orderId}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "store"
|
- "store"
|
||||||
@ -266,14 +338,17 @@ paths:
|
|||||||
\ values will generated exceptions"
|
\ values will generated exceptions"
|
||||||
operationId: "getOrderById"
|
operationId: "getOrderById"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "orderId"
|
- name: "orderId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of pet that needs to be fetched"
|
description: "ID of pet that needs to be fetched"
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "integer"
|
||||||
|
maximum: 5.0
|
||||||
|
minimum: 1.0
|
||||||
|
format: "int64"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
@ -291,20 +366,21 @@ paths:
|
|||||||
\ above 1000 or nonintegers will generate API errors"
|
\ above 1000 or nonintegers will generate API errors"
|
||||||
operationId: "deleteOrder"
|
operationId: "deleteOrder"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "orderId"
|
- name: "orderId"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "ID of the order that needs to be deleted"
|
description: "ID of the order that needs to be deleted"
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
|
minimum: 1.0
|
||||||
responses:
|
responses:
|
||||||
400:
|
400:
|
||||||
description: "Invalid ID supplied"
|
description: "Invalid ID supplied"
|
||||||
404:
|
404:
|
||||||
description: "Order not found"
|
description: "Order not found"
|
||||||
/users:
|
/user:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -312,19 +388,19 @@ paths:
|
|||||||
description: "This can only be done by the logged in user."
|
description: "This can only be done by the logged in user."
|
||||||
operationId: "createUser"
|
operationId: "createUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Created user object"
|
description: "Created user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
/users/createWithArray:
|
/user/createWithArray:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -332,13 +408,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "createUsersWithArrayInput"
|
operationId: "createUsersWithArrayInput"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "List of user object"
|
description: "List of user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
@ -346,7 +422,7 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
/users/createWithList:
|
/user/createWithList:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -354,13 +430,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "createUsersWithListInput"
|
operationId: "createUsersWithListInput"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "List of user object"
|
description: "List of user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
@ -368,7 +444,7 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
/users/login:
|
/user/login:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -376,27 +452,36 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "loginUser"
|
operationId: "loginUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "The user name for login"
|
description: "The user name for login"
|
||||||
required: false
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
- name: "password"
|
- name: "password"
|
||||||
in: "query"
|
in: "query"
|
||||||
description: "The password for login in clear text"
|
description: "The password for login in clear text"
|
||||||
required: false
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
schema:
|
schema:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
headers:
|
||||||
|
X-Rate-Limit:
|
||||||
|
type: "integer"
|
||||||
|
format: "int32"
|
||||||
|
description: "calls per hour allowed by the user"
|
||||||
|
X-Expires-After:
|
||||||
|
type: "string"
|
||||||
|
format: "date-time"
|
||||||
|
description: "date in UTC when toekn expires"
|
||||||
400:
|
400:
|
||||||
description: "Invalid username/password supplied"
|
description: "Invalid username/password supplied"
|
||||||
/users/logout:
|
/user/logout:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -404,13 +489,13 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "logoutUser"
|
operationId: "logoutUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters: []
|
parameters: []
|
||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: "successful operation"
|
description: "successful operation"
|
||||||
/users/{username}:
|
/user/{username}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "user"
|
- "user"
|
||||||
@ -418,12 +503,12 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
operationId: "getUserByName"
|
operationId: "getUserByName"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "path"
|
in: "path"
|
||||||
description: "The name that needs to be fetched. Use user1 for testing."
|
description: "The name that needs to be fetched. Use user1 for testing. "
|
||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
responses:
|
responses:
|
||||||
@ -442,8 +527,8 @@ paths:
|
|||||||
description: "This can only be done by the logged in user."
|
description: "This can only be done by the logged in user."
|
||||||
operationId: "updateUser"
|
operationId: "updateUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "path"
|
in: "path"
|
||||||
@ -453,7 +538,7 @@ paths:
|
|||||||
- in: "body"
|
- in: "body"
|
||||||
name: "body"
|
name: "body"
|
||||||
description: "Updated user object"
|
description: "Updated user object"
|
||||||
required: false
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
responses:
|
responses:
|
||||||
@ -468,8 +553,8 @@ paths:
|
|||||||
description: "This can only be done by the logged in user."
|
description: "This can only be done by the logged in user."
|
||||||
operationId: "deleteUser"
|
operationId: "deleteUser"
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
- "application/xml"
|
||||||
|
- "application/json"
|
||||||
parameters:
|
parameters:
|
||||||
- name: "username"
|
- name: "username"
|
||||||
in: "path"
|
in: "path"
|
||||||
@ -491,9 +576,46 @@ securityDefinitions:
|
|||||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||||
flow: "implicit"
|
flow: "implicit"
|
||||||
scopes:
|
scopes:
|
||||||
write_pets: "modify pets in your account"
|
write:pets: "modify pets in your account"
|
||||||
read_pets: "read your pets"
|
read:pets: "read your pets"
|
||||||
definitions:
|
definitions:
|
||||||
|
Order:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
petId:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
quantity:
|
||||||
|
type: "integer"
|
||||||
|
format: "int32"
|
||||||
|
shipDate:
|
||||||
|
type: "string"
|
||||||
|
format: "date-time"
|
||||||
|
status:
|
||||||
|
type: "string"
|
||||||
|
description: "Order Status"
|
||||||
|
enum:
|
||||||
|
- "placed"
|
||||||
|
- "approved"
|
||||||
|
- "delivered"
|
||||||
|
complete:
|
||||||
|
type: "boolean"
|
||||||
|
default: false
|
||||||
|
xml:
|
||||||
|
name: "Order"
|
||||||
|
Category:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: "integer"
|
||||||
|
format: "int64"
|
||||||
|
name:
|
||||||
|
type: "string"
|
||||||
|
xml:
|
||||||
|
name: "Category"
|
||||||
User:
|
User:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
@ -516,7 +638,9 @@ definitions:
|
|||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int32"
|
format: "int32"
|
||||||
description: "User Status"
|
description: "User Status"
|
||||||
Category:
|
xml:
|
||||||
|
name: "User"
|
||||||
|
Tag:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
@ -524,6 +648,8 @@ definitions:
|
|||||||
format: "int64"
|
format: "int64"
|
||||||
name:
|
name:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
xml:
|
||||||
|
name: "Tag"
|
||||||
Pet:
|
Pet:
|
||||||
type: "object"
|
type: "object"
|
||||||
required:
|
required:
|
||||||
@ -540,40 +666,37 @@ definitions:
|
|||||||
example: "doggie"
|
example: "doggie"
|
||||||
photoUrls:
|
photoUrls:
|
||||||
type: "array"
|
type: "array"
|
||||||
|
xml:
|
||||||
|
name: "photoUrl"
|
||||||
|
wrapped: true
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
tags:
|
tags:
|
||||||
type: "array"
|
type: "array"
|
||||||
|
xml:
|
||||||
|
name: "tag"
|
||||||
|
wrapped: true
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/Tag"
|
$ref: "#/definitions/Tag"
|
||||||
status:
|
status:
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "pet status in the store"
|
description: "pet status in the store"
|
||||||
Tag:
|
enum:
|
||||||
|
- "available"
|
||||||
|
- "pending"
|
||||||
|
- "sold"
|
||||||
|
xml:
|
||||||
|
name: "Pet"
|
||||||
|
ApiResponse:
|
||||||
type: "object"
|
type: "object"
|
||||||
properties:
|
properties:
|
||||||
id:
|
code:
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
name:
|
|
||||||
type: "string"
|
|
||||||
Order:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
petId:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
quantity:
|
|
||||||
type: "integer"
|
type: "integer"
|
||||||
format: "int32"
|
format: "int32"
|
||||||
shipDate:
|
type:
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "date-time"
|
message:
|
||||||
status:
|
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "Order Status"
|
externalDocs:
|
||||||
complete:
|
description: "Find out more about Swagger"
|
||||||
type: "boolean"
|
url: "http://swagger.io"
|
||||||
|
@ -9,11 +9,205 @@ require_once __DIR__ . '/vendor/autoload.php';
|
|||||||
$app = new Slim\App();
|
$app = new Slim\App();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST addPet
|
||||||
|
* Summary: Add a new pet to the store
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->POST('/pet', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$response->write('How about implementing addPet as a POST method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE deletePet
|
||||||
|
* Summary: Deletes a pet
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
||||||
|
$headers = $request->getHeaders();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing deletePet as a DELETE method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET findPetsByStatus
|
||||||
|
* Summary: Finds Pets by status
|
||||||
|
* Notes: Multiple status values can be provided with comma separated strings
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->GET('/pet/findByStatus', function($request, $response, $args) {
|
||||||
|
|
||||||
|
$queryParams = $request->getQueryParams();
|
||||||
|
$status = $queryParams['status'];
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing findPetsByStatus as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET findPetsByTags
|
||||||
|
* Summary: Finds Pets by tags
|
||||||
|
* Notes: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->GET('/pet/findByTags', function($request, $response, $args) {
|
||||||
|
|
||||||
|
$queryParams = $request->getQueryParams();
|
||||||
|
$tags = $queryParams['tags'];
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing findPetsByTags as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getPetById
|
||||||
|
* Summary: Find pet by ID
|
||||||
|
* Notes: Returns a single pet
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->GET('/pet/{petId}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getPetById as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PUT updatePet
|
||||||
|
* Summary: Update an existing pet
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->PUT('/pet', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$response->write('How about implementing updatePet as a PUT method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST updatePetWithForm
|
||||||
|
* Summary: Updates a pet in the store with form data
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->POST('/pet/{petId}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
$name = $args['name']; $status = $args['status'];
|
||||||
|
|
||||||
|
$response->write('How about implementing updatePetWithForm as a POST method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST uploadFile
|
||||||
|
* Summary: uploads an image
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/json]
|
||||||
|
*/
|
||||||
|
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
$additionalMetadata = $args['additionalMetadata']; $file = $args['file'];
|
||||||
|
|
||||||
|
$response->write('How about implementing uploadFile as a POST method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE deleteOrder
|
||||||
|
* Summary: Delete purchase order by ID
|
||||||
|
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing deleteOrder as a DELETE method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getInventory
|
||||||
|
* Summary: Returns pet inventories by status
|
||||||
|
* Notes: Returns a map of status codes to quantities
|
||||||
|
* Output-Formats: [application/json]
|
||||||
|
*/
|
||||||
|
$app->GET('/store/inventory', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getInventory as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getOrderById
|
||||||
|
* Summary: Find purchase order by ID
|
||||||
|
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->GET('/store/order/{orderId}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getOrderById as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST placeOrder
|
||||||
|
* Summary: Place an order for a pet
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->POST('/store/order', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$body = $request->getParsedBody();
|
||||||
|
$response->write('How about implementing placeOrder as a POST method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POST createUser
|
* POST createUser
|
||||||
* Summary: Create user
|
* Summary: Create user
|
||||||
* Notes: This can only be done by the logged in user.
|
* Notes: This can only be done by the logged in user.
|
||||||
* Output-Formats: [application/json, application/xml]
|
* Output-Formats: [application/xml, application/json]
|
||||||
*/
|
*/
|
||||||
$app->POST('/user', function($request, $response, $args) {
|
$app->POST('/user', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -29,7 +223,7 @@ $app->POST('/user', function($request, $response, $args) {
|
|||||||
* POST createUsersWithArrayInput
|
* POST createUsersWithArrayInput
|
||||||
* Summary: Creates list of users with given input array
|
* Summary: Creates list of users with given input array
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/json, application/xml]
|
* Output-Formats: [application/xml, application/json]
|
||||||
*/
|
*/
|
||||||
$app->POST('/user/createWithArray', function($request, $response, $args) {
|
$app->POST('/user/createWithArray', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -45,7 +239,7 @@ $app->POST('/user/createWithArray', function($request, $response, $args) {
|
|||||||
* POST createUsersWithListInput
|
* POST createUsersWithListInput
|
||||||
* Summary: Creates list of users with given input array
|
* Summary: Creates list of users with given input array
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/json, application/xml]
|
* Output-Formats: [application/xml, application/json]
|
||||||
*/
|
*/
|
||||||
$app->POST('/user/createWithList', function($request, $response, $args) {
|
$app->POST('/user/createWithList', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -57,11 +251,43 @@ $app->POST('/user/createWithList', function($request, $response, $args) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DELETE deleteUser
|
||||||
|
* Summary: Delete user
|
||||||
|
* Notes: This can only be done by the logged in user.
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->DELETE('/user/{username}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing deleteUser as a DELETE method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET getUserByName
|
||||||
|
* Summary: Get user by user name
|
||||||
|
* Notes:
|
||||||
|
* Output-Formats: [application/xml, application/json]
|
||||||
|
*/
|
||||||
|
$app->GET('/user/{username}', function($request, $response, $args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response->write('How about implementing getUserByName as a GET method ?');
|
||||||
|
return $response;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET loginUser
|
* GET loginUser
|
||||||
* Summary: Logs user into the system
|
* Summary: Logs user into the system
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/json, application/xml]
|
* Output-Formats: [application/xml, application/json]
|
||||||
*/
|
*/
|
||||||
$app->GET('/user/login', function($request, $response, $args) {
|
$app->GET('/user/login', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -78,7 +304,7 @@ $app->GET('/user/login', function($request, $response, $args) {
|
|||||||
* GET logoutUser
|
* GET logoutUser
|
||||||
* Summary: Logs out current logged in user session
|
* Summary: Logs out current logged in user session
|
||||||
* Notes:
|
* Notes:
|
||||||
* Output-Formats: [application/json, application/xml]
|
* Output-Formats: [application/xml, application/json]
|
||||||
*/
|
*/
|
||||||
$app->GET('/user/logout', function($request, $response, $args) {
|
$app->GET('/user/logout', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -90,27 +316,11 @@ $app->GET('/user/logout', function($request, $response, $args) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getUserByName
|
|
||||||
* Summary: Get user by user name
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/user/{username}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getUserByName as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PUT updateUser
|
* PUT updateUser
|
||||||
* Summary: Updated user
|
* Summary: Updated user
|
||||||
* Notes: This can only be done by the logged in user.
|
* Notes: This can only be done by the logged in user.
|
||||||
* Output-Formats: [application/json, application/xml]
|
* Output-Formats: [application/xml, application/json]
|
||||||
*/
|
*/
|
||||||
$app->PUT('/user/{username}', function($request, $response, $args) {
|
$app->PUT('/user/{username}', function($request, $response, $args) {
|
||||||
|
|
||||||
@ -122,247 +332,5 @@ $app->PUT('/user/{username}', function($request, $response, $args) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DELETE deleteUser
|
|
||||||
* Summary: Delete user
|
|
||||||
* Notes: This can only be done by the logged in user.
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->DELETE('/user/{username}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing deleteUser as a DELETE method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PUT updatePet
|
|
||||||
* Summary: Update an existing pet
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->PUT('/pet', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$body = $request->getParsedBody();
|
|
||||||
$response->write('How about implementing updatePet as a PUT method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST addPet
|
|
||||||
* Summary: Add a new pet to the store
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->POST('/pet', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$body = $request->getParsedBody();
|
|
||||||
$response->write('How about implementing addPet as a POST method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET findPetsByStatus
|
|
||||||
* Summary: Finds Pets by status
|
|
||||||
* Notes: Multiple status values can be provided with comma seperated strings
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/pet/findByStatus', function($request, $response, $args) {
|
|
||||||
|
|
||||||
$queryParams = $request->getQueryParams();
|
|
||||||
$status = $queryParams['status'];
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing findPetsByStatus as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET findPetsByTags
|
|
||||||
* Summary: Finds Pets by tags
|
|
||||||
* Notes: Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/pet/findByTags', function($request, $response, $args) {
|
|
||||||
|
|
||||||
$queryParams = $request->getQueryParams();
|
|
||||||
$tags = $queryParams['tags'];
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing findPetsByTags as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getPetById
|
|
||||||
* Summary: Find pet by ID
|
|
||||||
* Notes: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/pet/{petId}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getPetById as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST updatePetWithForm
|
|
||||||
* Summary: Updates a pet in the store with form data
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->POST('/pet/{petId}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
$name = $args['name']; $status = $args['status'];
|
|
||||||
|
|
||||||
$response->write('How about implementing updatePetWithForm as a POST method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DELETE deletePet
|
|
||||||
* Summary: Deletes a pet
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->DELETE('/pet/{petId}', function($request, $response, $args) {
|
|
||||||
$headers = $request->getHeaders();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing deletePet as a DELETE method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST uploadFile
|
|
||||||
* Summary: uploads an image
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->POST('/pet/{petId}/uploadImage', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
$additionalMetadata = $args['additionalMetadata']; $file = $args['file'];
|
|
||||||
|
|
||||||
$response->write('How about implementing uploadFile as a POST method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getPetByIdWithByteArray
|
|
||||||
* Summary: Fake endpoint to test byte array return by 'Find pet by ID'
|
|
||||||
* Notes: Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/pet/{petId}?testing_byte_array=true', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getPetByIdWithByteArray as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST addPetUsingByteArray
|
|
||||||
* Summary: Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->POST('/pet?testing_byte_array=true', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$body = $request->getParsedBody();
|
|
||||||
$response->write('How about implementing addPetUsingByteArray as a POST method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getInventory
|
|
||||||
* Summary: Returns pet inventories by status
|
|
||||||
* Notes: Returns a map of status codes to quantities
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/store/inventory', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getInventory as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST placeOrder
|
|
||||||
* Summary: Place an order for a pet
|
|
||||||
* Notes:
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->POST('/store/order', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$body = $request->getParsedBody();
|
|
||||||
$response->write('How about implementing placeOrder as a POST method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET getOrderById
|
|
||||||
* Summary: Find purchase order by ID
|
|
||||||
* Notes: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->GET('/store/order/{orderId}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing getOrderById as a GET method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DELETE deleteOrder
|
|
||||||
* Summary: Delete purchase order by ID
|
|
||||||
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
* Output-Formats: [application/json, application/xml]
|
|
||||||
*/
|
|
||||||
$app->DELETE('/store/order/{orderId}', function($request, $response, $args) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$response->write('How about implementing deleteOrder as a DELETE method ?');
|
|
||||||
return $response;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app->run();
|
$app->run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user