Merge pull request #2490 from wing328/fix_spec_typo

[Sinatra] fix typo, update sinatra to use origianl petstore spec (yaml)
This commit is contained in:
wing328 2016-04-04 16:29:13 +08:00
commit af75243a31
8 changed files with 600 additions and 857 deletions

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead. # if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/sinatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l sinatra -o samples/server/petstore/sinatra" ags="$@ generate -t modules/swagger-codegen/src/main/resources/sinatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l sinatra -o samples/server/petstore/sinatra"
java $JAVA_OPTS -jar $executable $ags java $JAVA_OPTS -jar $executable $ags

View File

@ -1301,7 +1301,7 @@
} }
}, },
"Return": { "Return": {
"descripton": "Model for testing reserved words", "description": "Model for testing reserved words",
"properties": { "properties": {
"return": { "return": {
"type": "integer", "type": "integer",
@ -1313,7 +1313,7 @@
} }
}, },
"Name": { "Name": {
"descripton": "Model for testing model name same as property name", "description": "Model for testing model name same as property name",
"properties": { "properties": {
"name": { "name": {
"type": "integer", "type": "integer",
@ -1329,7 +1329,7 @@
} }
}, },
"200_response": { "200_response": {
"descripton": "Model for testing model name starting with number", "description": "Model for testing model name starting with number",
"properties": { "properties": {
"name": { "name": {
"type": "integer", "type": "integer",

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +1,12 @@
require 'json' require 'json'
MyApp.add_route('PUT', '/v2/pet', { MyApp.add_route('POST', '/v2/pets', {
"resourcePath" => "/Pet",
"summary" => "Update an existing pet",
"nickname" => "update_pet",
"responseClass" => "void",
"endpoint" => "/pet",
"notes" => "",
"parameters" => [
{
"name" => "body",
"description" => "Pet object that needs to be added to the store",
"dataType" => "Pet",
"paramType" => "body",
}
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
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" => "/pet", "endpoint" => "/pets",
"notes" => "", "notes" => "",
"parameters" => [ "parameters" => [
@ -55,126 +28,12 @@ MyApp.add_route('POST', '/v2/pet', {
end end
MyApp.add_route('GET', '/v2/pet/findByStatus', { MyApp.add_route('DELETE', '/v2/pets/{petId}', {
"resourcePath" => "/Pet",
"summary" => "Finds Pets by status",
"nickname" => "find_pets_by_status",
"responseClass" => "array[Pet]",
"endpoint" => "/pet/findByStatus",
"notes" => "Multiple status values can be provided with comma seperated strings",
"parameters" => [
{
"name" => "status",
"description" => "Status values that need to be considered for filter",
"dataType" => "array[string]",
"paramType" => "query",
"collectionFormat" => "multi",
"allowableValues" => "",
"defaultValue" => "available"
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('GET', '/v2/pet/findByTags', {
"resourcePath" => "/Pet",
"summary" => "Finds Pets by tags",
"nickname" => "find_pets_by_tags",
"responseClass" => "array[Pet]",
"endpoint" => "/pet/findByTags",
"notes" => "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
"parameters" => [
{
"name" => "tags",
"description" => "Tags to filter by",
"dataType" => "array[string]",
"paramType" => "query",
"collectionFormat" => "multi",
"allowableValues" => "",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('GET', '/v2/pet/{petId}', {
"resourcePath" => "/Pet",
"summary" => "Find pet by ID",
"nickname" => "get_pet_by_id",
"responseClass" => "Pet",
"endpoint" => "/pet/{petId}",
"notes" => "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
"parameters" => [
{
"name" => "pet_id",
"description" => "ID of pet that needs to be fetched",
"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}', {
"resourcePath" => "/Pet",
"summary" => "Updates a pet in the store with form data",
"nickname" => "update_pet_with_form",
"responseClass" => "void",
"endpoint" => "/pet/{petId}",
"notes" => "",
"parameters" => [
{
"name" => "pet_id",
"description" => "ID of pet that needs to be updated",
"dataType" => "string",
"paramType" => "path",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
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" => "/pet/{petId}", "endpoint" => "/pets/{petId}",
"notes" => "", "notes" => "",
"parameters" => [ "parameters" => [
@ -203,25 +62,139 @@ MyApp.add_route('DELETE', '/v2/pet/{petId}', {
end end
MyApp.add_route('POST', '/v2/pet/{petId}/uploadImage', { MyApp.add_route('GET', '/v2/pets/findByStatus', {
"resourcePath" => "/Pet", "resourcePath" => "/Pet",
"summary" => "uploads an image", "summary" => "Finds Pets by status",
"nickname" => "upload_file", "nickname" => "find_pets_by_status",
"responseClass" => "void", "responseClass" => "array[Pet]",
"endpoint" => "/pet/{petId}/uploadImage", "endpoint" => "/pets/findByStatus",
"notes" => "", "notes" => "Multiple status values can be provided with comma seperated strings",
"parameters" => [
{
"name" => "status",
"description" => "Status values that need to be considered for filter",
"dataType" => "array[string]",
"paramType" => "query",
"collectionFormat" => "multi",
"allowableValues" => "",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('GET', '/v2/pets/findByTags', {
"resourcePath" => "/Pet",
"summary" => "Finds Pets by tags",
"nickname" => "find_pets_by_tags",
"responseClass" => "array[Pet]",
"endpoint" => "/pets/findByTags",
"notes" => "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
"parameters" => [
{
"name" => "tags",
"description" => "Tags to filter by",
"dataType" => "array[string]",
"paramType" => "query",
"collectionFormat" => "multi",
"allowableValues" => "",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('GET', '/v2/pets/{petId}', {
"resourcePath" => "/Pet",
"summary" => "Find pet by ID",
"nickname" => "get_pet_by_id",
"responseClass" => "Pet",
"endpoint" => "/pets/{petId}",
"notes" => "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
"parameters" => [ "parameters" => [
{ {
"name" => "pet_id", "name" => "pet_id",
"description" => "ID of pet to update", "description" => "ID of pet that needs to be fetched",
"dataType" => "int", "dataType" => "int",
"paramType" => "path", "paramType" => "path",
}, },
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('PUT', '/v2/pets', {
"resourcePath" => "/Pet",
"summary" => "Update an existing pet",
"nickname" => "update_pet",
"responseClass" => "void",
"endpoint" => "/pets",
"notes" => "",
"parameters" => [
{
"name" => "body",
"description" => "Pet object that needs to be added to the store",
"dataType" => "Pet",
"paramType" => "body",
}
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('POST', '/v2/pets/{petId}', {
"resourcePath" => "/Pet",
"summary" => "Updates a pet in the store with form data",
"nickname" => "update_pet_with_form",
"responseClass" => "void",
"endpoint" => "/pets/{petId}",
"notes" => "",
"parameters" => [
{
"name" => "pet_id",
"description" => "ID of pet that needs to be updated",
"dataType" => "string",
"paramType" => "path",
},
]}) do ]}) do
cross_origin cross_origin
# the guts live here # the guts live here

View File

@ -1,44 +1,24 @@
require 'json' require 'json'
MyApp.add_route('GET', '/v2/store/inventory', { MyApp.add_route('DELETE', '/v2/stores/order/{orderId}', {
"resourcePath" => "/Store", "resourcePath" => "/Store",
"summary" => "Returns pet inventories by status", "summary" => "Delete purchase order by ID",
"nickname" => "get_inventory", "nickname" => "delete_order",
"responseClass" => "map[string,int]", "responseClass" => "void",
"endpoint" => "/store/inventory", "endpoint" => "/stores/order/{orderId}",
"notes" => "Returns a map of status codes to quantities", "notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
"parameters" => [ "parameters" => [
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('POST', '/v2/store/order', {
"resourcePath" => "/Store",
"summary" => "Place an order for a pet",
"nickname" => "place_order",
"responseClass" => "Order",
"endpoint" => "/store/order",
"notes" => "",
"parameters" => [
{ {
"name" => "body", "name" => "order_id",
"description" => "order placed for purchasing the pet", "description" => "ID of the order that needs to be deleted",
"dataType" => "Order", "dataType" => "string",
"paramType" => "body", "paramType" => "path",
} },
]}) do ]}) do
cross_origin cross_origin
@ -48,12 +28,12 @@ MyApp.add_route('POST', '/v2/store/order', {
end end
MyApp.add_route('GET', '/v2/store/order/{orderId}', { MyApp.add_route('GET', '/v2/stores/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" => "/store/order/{orderId}", "endpoint" => "/stores/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" => [
@ -75,24 +55,24 @@ MyApp.add_route('GET', '/v2/store/order/{orderId}', {
end end
MyApp.add_route('DELETE', '/v2/store/order/{orderId}', { MyApp.add_route('POST', '/v2/stores/order', {
"resourcePath" => "/Store", "resourcePath" => "/Store",
"summary" => "Delete purchase order by ID", "summary" => "Place an order for a pet",
"nickname" => "delete_order", "nickname" => "place_order",
"responseClass" => "void", "responseClass" => "Order",
"endpoint" => "/store/order/{orderId}", "endpoint" => "/stores/order",
"notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", "notes" => "",
"parameters" => [ "parameters" => [
{ {
"name" => "order_id", "name" => "body",
"description" => "ID of the order that needs to be deleted", "description" => "order placed for purchasing the pet",
"dataType" => "string", "dataType" => "Order",
"paramType" => "path", "paramType" => "body",
}, }
]}) do ]}) do
cross_origin cross_origin

View File

@ -1,12 +1,12 @@
require 'json' require 'json'
MyApp.add_route('POST', '/v2/user', { MyApp.add_route('POST', '/v2/users', {
"resourcePath" => "/User", "resourcePath" => "/User",
"summary" => "Create user", "summary" => "Create user",
"nickname" => "create_user", "nickname" => "create_user",
"responseClass" => "void", "responseClass" => "void",
"endpoint" => "/user", "endpoint" => "/users",
"notes" => "This can only be done by the logged in user.", "notes" => "This can only be done by the logged in user.",
"parameters" => [ "parameters" => [
@ -28,12 +28,12 @@ MyApp.add_route('POST', '/v2/user', {
end end
MyApp.add_route('POST', '/v2/user/createWithArray', { MyApp.add_route('POST', '/v2/users/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" => "/user/createWithArray", "endpoint" => "/users/createWithArray",
"notes" => "", "notes" => "",
"parameters" => [ "parameters" => [
@ -55,12 +55,12 @@ MyApp.add_route('POST', '/v2/user/createWithArray', {
end end
MyApp.add_route('POST', '/v2/user/createWithList', { MyApp.add_route('POST', '/v2/users/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" => "/user/createWithList", "endpoint" => "/users/createWithList",
"notes" => "", "notes" => "",
"parameters" => [ "parameters" => [
@ -82,12 +82,66 @@ MyApp.add_route('POST', '/v2/user/createWithList', {
end end
MyApp.add_route('GET', '/v2/user/login', { MyApp.add_route('DELETE', '/v2/users/{username}', {
"resourcePath" => "/User",
"summary" => "Delete user",
"nickname" => "delete_user",
"responseClass" => "void",
"endpoint" => "/users/{username}",
"notes" => "This can only be done by the logged in user.",
"parameters" => [
{
"name" => "username",
"description" => "The name that needs to be deleted",
"dataType" => "string",
"paramType" => "path",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('GET', '/v2/users/{username}', {
"resourcePath" => "/User",
"summary" => "Get user by user name",
"nickname" => "get_user_by_name",
"responseClass" => "User",
"endpoint" => "/users/{username}",
"notes" => "",
"parameters" => [
{
"name" => "username",
"description" => "The name that needs to be fetched. Use user1 for testing.",
"dataType" => "string",
"paramType" => "path",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
MyApp.add_route('GET', '/v2/users/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" => "/user/login", "endpoint" => "/users/login",
"notes" => "", "notes" => "",
"parameters" => [ "parameters" => [
@ -122,12 +176,12 @@ MyApp.add_route('GET', '/v2/user/login', {
end end
MyApp.add_route('GET', '/v2/user/logout', { MyApp.add_route('GET', '/v2/users/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" => "/user/logout", "endpoint" => "/users/logout",
"notes" => "", "notes" => "",
"parameters" => [ "parameters" => [
@ -142,39 +196,12 @@ MyApp.add_route('GET', '/v2/user/logout', {
end end
MyApp.add_route('GET', '/v2/user/{username}', { MyApp.add_route('PUT', '/v2/users/{username}', {
"resourcePath" => "/User",
"summary" => "Get user by user name",
"nickname" => "get_user_by_name",
"responseClass" => "User",
"endpoint" => "/user/{username}",
"notes" => "",
"parameters" => [
{
"name" => "username",
"description" => "The name that needs to be fetched. Use user1 for testing.",
"dataType" => "string",
"paramType" => "path",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end
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" => "/user/{username}", "endpoint" => "/users/{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" => [
@ -202,30 +229,3 @@ MyApp.add_route('PUT', '/v2/user/{username}', {
{"message" => "yes, it worked"}.to_json {"message" => "yes, it worked"}.to_json
end end
MyApp.add_route('DELETE', '/v2/user/{username}', {
"resourcePath" => "/User",
"summary" => "Delete user",
"nickname" => "delete_user",
"responseClass" => "void",
"endpoint" => "/user/{username}",
"notes" => "This can only be done by the logged in user.",
"parameters" => [
{
"name" => "username",
"description" => "The name that needs to be deleted",
"dataType" => "string",
"paramType" => "path",
},
]}) do
cross_origin
# the guts live here
{"message" => "yes, it worked"}.to_json
end

View File

@ -39,7 +39,7 @@ class Swaggering < Sinatra::Base
def self.add_route(method, path, swag={}, opts={}, &block) def self.add_route(method, path, swag={}, opts={}, &block)
#fullPath = swag["resourcePath"].to_s + @@configuration.format_specifier + path #fullPath = swag["resourcePath"].to_s + @@configuration.format_specifier + path
fullPath = path.gsub(/{(.*)}/, ':\1') fullPath = path.gsub(/{(.*?)}/, ':\1')
accepted = case method.to_s.downcase accepted = case method.to_s.downcase
when 'get' when 'get'

View File

@ -1,15 +1,14 @@
--- ---
swagger: "2.0" swagger: "2.0"
info: info:
description: "This is a sample server Petstore server. You can find out more about\ description: "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io)\
\ Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net,\ \ or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample,\
\ #swagger. For this sample, you can use the api key \"special-key\" to test\ \ you can use the api key `special-key` to test the authorization filters\n"
\ the authorization filters"
version: "1.0.0" version: "1.0.0"
title: "Swagger Petstore" title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/" termsOfService: "http://helloreverb.com/terms/"
contact: contact:
email: "apiteam@swagger.io" name: "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"
@ -18,7 +17,7 @@ basePath: "/v2"
schemes: schemes:
- "http" - "http"
paths: paths:
/pet: /pets:
post: post:
tags: tags:
- "pet" - "pet"
@ -43,8 +42,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"
@ -73,9 +72,9 @@ paths:
description: "Validation exception" description: "Validation exception"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
/pet/findByStatus: /pets/findByStatus:
get: get:
tags: tags:
- "pet" - "pet"
@ -94,7 +93,6 @@ paths:
items: items:
type: "string" type: "string"
collectionFormat: "multi" collectionFormat: "multi"
default: "available"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
@ -106,9 +104,9 @@ paths:
description: "Invalid status value" description: "Invalid status value"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
/pet/findByTags: /pets/findByTags:
get: get:
tags: tags:
- "pet" - "pet"
@ -139,9 +137,9 @@ paths:
description: "Invalid tag value" description: "Invalid tag value"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
/pet/{petId}: /pets/{petId}:
get: get:
tags: tags:
- "pet" - "pet"
@ -171,8 +169,8 @@ paths:
security: security:
- api_key: [] - api_key: []
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
post: post:
tags: tags:
- "pet" - "pet"
@ -193,20 +191,20 @@ paths:
- name: "name" - name: "name"
in: "formData" in: "formData"
description: "Updated name of the pet" description: "Updated name of the pet"
required: false required: true
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: false required: true
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"
@ -220,7 +218,7 @@ paths:
- name: "api_key" - name: "api_key"
in: "header" in: "header"
description: "" description: ""
required: false required: true
type: "string" type: "string"
- name: "petId" - name: "petId"
in: "path" in: "path"
@ -233,66 +231,9 @@ paths:
description: "Invalid pet value" description: "Invalid pet value"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
/pet/{petId}/uploadImage: /stores/order:
post:
tags:
- "pet"
summary: "uploads an image"
description: ""
operationId: "uploadFile"
consumes:
- "multipart/form-data"
produces:
- "application/json"
- "application/xml"
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:
default:
description: "successful operation"
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"
- "application/xml"
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"
@ -316,7 +257,7 @@ paths:
$ref: "#/definitions/Order" $ref: "#/definitions/Order"
400: 400:
description: "Invalid Order" description: "Invalid Order"
/store/order/{orderId}: /stores/order/{orderId}:
get: get:
tags: tags:
- "store" - "store"
@ -363,7 +304,7 @@ paths:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
description: "Order not found" description: "Order not found"
/user: /users:
post: post:
tags: tags:
- "user" - "user"
@ -383,7 +324,7 @@ paths:
responses: responses:
default: default:
description: "successful operation" description: "successful operation"
/user/createWithArray: /users/createWithArray:
post: post:
tags: tags:
- "user" - "user"
@ -405,7 +346,7 @@ paths:
responses: responses:
default: default:
description: "successful operation" description: "successful operation"
/user/createWithList: /users/createWithList:
post: post:
tags: tags:
- "user" - "user"
@ -427,7 +368,7 @@ paths:
responses: responses:
default: default:
description: "successful operation" description: "successful operation"
/user/login: /users/login:
get: get:
tags: tags:
- "user" - "user"
@ -455,7 +396,7 @@ paths:
type: "string" type: "string"
400: 400:
description: "Invalid username/password supplied" description: "Invalid username/password supplied"
/user/logout: /users/logout:
get: get:
tags: tags:
- "user" - "user"
@ -469,7 +410,7 @@ paths:
responses: responses:
default: default:
description: "successful operation" description: "successful operation"
/user/{username}: /users/{username}:
get: get:
tags: tags:
- "user" - "user"
@ -482,7 +423,7 @@ paths:
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:
@ -490,16 +431,6 @@ paths:
description: "successful operation" description: "successful operation"
schema: schema:
$ref: "#/definitions/User" $ref: "#/definitions/User"
examples:
application/json:
id: 1
username: "johnp"
firstName: "John"
lastName: "Public"
email: "johnp@swagger.io"
password: "-secret-"
phone: "0123456789"
userStatus: 0
400: 400:
description: "Invalid username supplied" description: "Invalid username supplied"
404: 404:
@ -560,10 +491,11 @@ 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:
User: User:
type: "object"
properties: properties:
id: id:
type: "integer" type: "integer"
@ -584,18 +516,16 @@ definitions:
type: "integer" type: "integer"
format: "int32" format: "int32"
description: "User Status" description: "User Status"
xml:
name: "User"
Category: Category:
type: "object"
properties: properties:
id: id:
type: "integer" type: "integer"
format: "int64" format: "int64"
name: name:
type: "string" type: "string"
xml:
name: "Category"
Pet: Pet:
type: "object"
required: required:
- "name" - "name"
- "photoUrls" - "photoUrls"
@ -610,37 +540,25 @@ 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"
enum:
- "available"
- "pending"
- "sold"
xml:
name: "Pet"
Tag: Tag:
type: "object"
properties: properties:
id: id:
type: "integer" type: "integer"
format: "int64" format: "int64"
name: name:
type: "string" type: "string"
xml:
name: "Tag"
Order: Order:
type: "object"
properties: properties:
id: id:
type: "integer" type: "integer"
@ -657,11 +575,5 @@ definitions:
status: status:
type: "string" type: "string"
description: "Order Status" description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete: complete:
type: "boolean" type: "boolean"
xml:
name: "Order"