mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 18:45:23 +00:00
fix typo, update sinatra to use origianl petstore spec (yaml)
This commit is contained in:
parent
aa805a4003
commit
c2cab84612
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# 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"
|
||||
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
|
||||
|
@ -1301,7 +1301,7 @@
|
||||
}
|
||||
},
|
||||
"Return": {
|
||||
"descripton": "Model for testing reserved words",
|
||||
"description": "Model for testing reserved words",
|
||||
"properties": {
|
||||
"return": {
|
||||
"type": "integer",
|
||||
@ -1313,7 +1313,7 @@
|
||||
}
|
||||
},
|
||||
"Name": {
|
||||
"descripton": "Model for testing model name same as property name",
|
||||
"description": "Model for testing model name same as property name",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "integer",
|
||||
@ -1329,7 +1329,7 @@
|
||||
}
|
||||
},
|
||||
"200_response": {
|
||||
"descripton": "Model for testing model name starting with number",
|
||||
"description": "Model for testing model name starting with number",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "integer",
|
||||
|
@ -1,39 +1,12 @@
|
||||
require 'json'
|
||||
|
||||
|
||||
MyApp.add_route('PUT', '/v2/pet', {
|
||||
"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', {
|
||||
MyApp.add_route('POST', '/v2/pets', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Add a new pet to the store",
|
||||
"nickname" => "add_pet",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pet",
|
||||
"endpoint" => "/pets",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
@ -55,126 +28,12 @@ MyApp.add_route('POST', '/v2/pet', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/pet/findByStatus', {
|
||||
"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}', {
|
||||
MyApp.add_route('DELETE', '/v2/pets/{petId}', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "Deletes a pet",
|
||||
"nickname" => "delete_pet",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pet/{petId}",
|
||||
"endpoint" => "/pets/{petId}",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
@ -203,25 +62,139 @@ MyApp.add_route('DELETE', '/v2/pet/{petId}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/pet/{petId}/uploadImage', {
|
||||
MyApp.add_route('GET', '/v2/pets/findByStatus', {
|
||||
"resourcePath" => "/Pet",
|
||||
"summary" => "uploads an image",
|
||||
"nickname" => "upload_file",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/pet/{petId}/uploadImage",
|
||||
"notes" => "",
|
||||
"summary" => "Finds Pets by status",
|
||||
"nickname" => "find_pets_by_status",
|
||||
"responseClass" => "array[Pet]",
|
||||
"endpoint" => "/pets/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" => "",
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
]}) 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" => [
|
||||
|
||||
|
||||
{
|
||||
"name" => "pet_id",
|
||||
"description" => "ID of pet to update",
|
||||
"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('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
|
||||
cross_origin
|
||||
# the guts live here
|
||||
|
@ -1,44 +1,24 @@
|
||||
require 'json'
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/store/inventory', {
|
||||
MyApp.add_route('DELETE', '/v2/stores/order/{orderId}', {
|
||||
"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",
|
||||
"summary" => "Delete purchase order by ID",
|
||||
"nickname" => "delete_order",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/stores/order/{orderId}",
|
||||
"notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||
"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",
|
||||
"description" => "order placed for purchasing the pet",
|
||||
"dataType" => "Order",
|
||||
"paramType" => "body",
|
||||
}
|
||||
"name" => "order_id",
|
||||
"description" => "ID of the order that needs to be deleted",
|
||||
"dataType" => "string",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
@ -48,12 +28,12 @@ MyApp.add_route('POST', '/v2/store/order', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/store/order/{orderId}', {
|
||||
MyApp.add_route('GET', '/v2/stores/order/{orderId}', {
|
||||
"resourcePath" => "/Store",
|
||||
"summary" => "Find purchase order by ID",
|
||||
"nickname" => "get_order_by_id",
|
||||
"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",
|
||||
"parameters" => [
|
||||
|
||||
@ -75,24 +55,24 @@ MyApp.add_route('GET', '/v2/store/order/{orderId}', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('DELETE', '/v2/store/order/{orderId}', {
|
||||
MyApp.add_route('POST', '/v2/stores/order', {
|
||||
"resourcePath" => "/Store",
|
||||
"summary" => "Delete purchase order by ID",
|
||||
"nickname" => "delete_order",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/store/order/{orderId}",
|
||||
"notes" => "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||
"summary" => "Place an order for a pet",
|
||||
"nickname" => "place_order",
|
||||
"responseClass" => "Order",
|
||||
"endpoint" => "/stores/order",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name" => "order_id",
|
||||
"description" => "ID of the order that needs to be deleted",
|
||||
"dataType" => "string",
|
||||
"paramType" => "path",
|
||||
},
|
||||
|
||||
|
||||
"name" => "body",
|
||||
"description" => "order placed for purchasing the pet",
|
||||
"dataType" => "Order",
|
||||
"paramType" => "body",
|
||||
}
|
||||
|
||||
]}) do
|
||||
cross_origin
|
||||
|
@ -1,12 +1,12 @@
|
||||
require 'json'
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/user', {
|
||||
MyApp.add_route('POST', '/v2/users', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Create user",
|
||||
"nickname" => "create_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/user",
|
||||
"endpoint" => "/users",
|
||||
"notes" => "This can only be done by the logged in user.",
|
||||
"parameters" => [
|
||||
|
||||
@ -28,12 +28,12 @@ MyApp.add_route('POST', '/v2/user', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/user/createWithArray', {
|
||||
MyApp.add_route('POST', '/v2/users/createWithArray', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Creates list of users with given input array",
|
||||
"nickname" => "create_users_with_array_input",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/user/createWithArray",
|
||||
"endpoint" => "/users/createWithArray",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
@ -55,12 +55,12 @@ MyApp.add_route('POST', '/v2/user/createWithArray', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('POST', '/v2/user/createWithList', {
|
||||
MyApp.add_route('POST', '/v2/users/createWithList', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Creates list of users with given input array",
|
||||
"nickname" => "create_users_with_list_input",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/user/createWithList",
|
||||
"endpoint" => "/users/createWithList",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
@ -82,12 +82,66 @@ MyApp.add_route('POST', '/v2/user/createWithList', {
|
||||
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",
|
||||
"summary" => "Logs user into the system",
|
||||
"nickname" => "login_user",
|
||||
"responseClass" => "string",
|
||||
"endpoint" => "/user/login",
|
||||
"endpoint" => "/users/login",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
@ -122,12 +176,12 @@ MyApp.add_route('GET', '/v2/user/login', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/user/logout', {
|
||||
MyApp.add_route('GET', '/v2/users/logout', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Logs out current logged in user session",
|
||||
"nickname" => "logout_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/user/logout",
|
||||
"endpoint" => "/users/logout",
|
||||
"notes" => "",
|
||||
"parameters" => [
|
||||
|
||||
@ -142,39 +196,12 @@ MyApp.add_route('GET', '/v2/user/logout', {
|
||||
end
|
||||
|
||||
|
||||
MyApp.add_route('GET', '/v2/user/{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}', {
|
||||
MyApp.add_route('PUT', '/v2/users/{username}', {
|
||||
"resourcePath" => "/User",
|
||||
"summary" => "Updated user",
|
||||
"nickname" => "update_user",
|
||||
"responseClass" => "void",
|
||||
"endpoint" => "/user/{username}",
|
||||
"endpoint" => "/users/{username}",
|
||||
"notes" => "This can only be done by the logged in user.",
|
||||
"parameters" => [
|
||||
|
||||
@ -202,30 +229,3 @@ MyApp.add_route('PUT', '/v2/user/{username}', {
|
||||
{"message" => "yes, it worked"}.to_json
|
||||
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
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Swaggering < Sinatra::Base
|
||||
|
||||
def self.add_route(method, path, swag={}, opts={}, &block)
|
||||
#fullPath = swag["resourcePath"].to_s + @@configuration.format_specifier + path
|
||||
fullPath = path.gsub(/{(.*)}/, ':\1')
|
||||
fullPath = path.gsub(/{(.*?)}/, ':\1')
|
||||
|
||||
accepted = case method.to_s.downcase
|
||||
when 'get'
|
||||
|
@ -1,15 +1,14 @@
|
||||
---
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: "This is a sample server Petstore server. You can find out more about\
|
||||
\ Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net,\
|
||||
\ #swagger. For this sample, you can use the api key \"special-key\" to test\
|
||||
\ the authorization filters"
|
||||
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"
|
||||
version: "1.0.0"
|
||||
title: "Swagger Petstore"
|
||||
termsOfService: "http://swagger.io/terms/"
|
||||
termsOfService: "http://helloreverb.com/terms/"
|
||||
contact:
|
||||
email: "apiteam@swagger.io"
|
||||
name: "apiteam@swagger.io"
|
||||
license:
|
||||
name: "Apache 2.0"
|
||||
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
@ -18,7 +17,7 @@ basePath: "/v2"
|
||||
schemes:
|
||||
- "http"
|
||||
paths:
|
||||
/pet:
|
||||
/pets:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -43,8 +42,8 @@ paths:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
put:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -73,9 +72,9 @@ paths:
|
||||
description: "Validation exception"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet/findByStatus:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/pets/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -94,7 +93,6 @@ paths:
|
||||
items:
|
||||
type: "string"
|
||||
collectionFormat: "multi"
|
||||
default: "available"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -106,9 +104,9 @@ paths:
|
||||
description: "Invalid status value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet/findByTags:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/pets/findByTags:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -139,9 +137,9 @@ paths:
|
||||
description: "Invalid tag value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet/{petId}:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/pets/{petId}:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -171,8 +169,8 @@ paths:
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -193,20 +191,20 @@ paths:
|
||||
- name: "name"
|
||||
in: "formData"
|
||||
description: "Updated name of the pet"
|
||||
required: false
|
||||
required: true
|
||||
type: "string"
|
||||
- name: "status"
|
||||
in: "formData"
|
||||
description: "Updated status of the pet"
|
||||
required: false
|
||||
required: true
|
||||
type: "string"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
delete:
|
||||
tags:
|
||||
- "pet"
|
||||
@ -220,7 +218,7 @@ paths:
|
||||
- name: "api_key"
|
||||
in: "header"
|
||||
description: ""
|
||||
required: false
|
||||
required: true
|
||||
type: "string"
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
@ -233,66 +231,9 @@ paths:
|
||||
description: "Invalid pet value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
/pet/{petId}/uploadImage:
|
||||
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:
|
||||
- "write_pets"
|
||||
- "read_pets"
|
||||
/stores/order:
|
||||
post:
|
||||
tags:
|
||||
- "store"
|
||||
@ -316,7 +257,7 @@ paths:
|
||||
$ref: "#/definitions/Order"
|
||||
400:
|
||||
description: "Invalid Order"
|
||||
/store/order/{orderId}:
|
||||
/stores/order/{orderId}:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
@ -363,7 +304,7 @@ paths:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Order not found"
|
||||
/user:
|
||||
/users:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -383,7 +324,7 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/user/createWithArray:
|
||||
/users/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -405,7 +346,7 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/user/createWithList:
|
||||
/users/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- "user"
|
||||
@ -427,7 +368,7 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/user/login:
|
||||
/users/login:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -455,7 +396,7 @@ paths:
|
||||
type: "string"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
/user/logout:
|
||||
/users/logout:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -469,7 +410,7 @@ paths:
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
/user/{username}:
|
||||
/users/{username}:
|
||||
get:
|
||||
tags:
|
||||
- "user"
|
||||
@ -482,7 +423,7 @@ paths:
|
||||
parameters:
|
||||
- name: "username"
|
||||
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
|
||||
type: "string"
|
||||
responses:
|
||||
@ -490,16 +431,6 @@ paths:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$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:
|
||||
description: "Invalid username supplied"
|
||||
404:
|
||||
@ -560,10 +491,11 @@ securityDefinitions:
|
||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||
flow: "implicit"
|
||||
scopes:
|
||||
write:pets: "modify pets in your account"
|
||||
read:pets: "read your pets"
|
||||
write_pets: "modify pets in your account"
|
||||
read_pets: "read your pets"
|
||||
definitions:
|
||||
User:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -584,18 +516,16 @@ definitions:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "User Status"
|
||||
xml:
|
||||
name: "User"
|
||||
Category:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
Pet:
|
||||
type: "object"
|
||||
required:
|
||||
- "name"
|
||||
- "photoUrls"
|
||||
@ -610,37 +540,25 @@ definitions:
|
||||
example: "doggie"
|
||||
photoUrls:
|
||||
type: "array"
|
||||
xml:
|
||||
name: "photoUrl"
|
||||
wrapped: true
|
||||
items:
|
||||
type: "string"
|
||||
tags:
|
||||
type: "array"
|
||||
xml:
|
||||
name: "tag"
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: "#/definitions/Tag"
|
||||
status:
|
||||
type: "string"
|
||||
description: "pet status in the store"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
xml:
|
||||
name: "Pet"
|
||||
Tag:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Tag"
|
||||
Order:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -657,11 +575,5 @@ definitions:
|
||||
status:
|
||||
type: "string"
|
||||
description: "Order Status"
|
||||
enum:
|
||||
- "placed"
|
||||
- "approved"
|
||||
- "delivered"
|
||||
complete:
|
||||
type: "boolean"
|
||||
xml:
|
||||
name: "Order"
|
||||
|
Loading…
Reference in New Issue
Block a user