forked from loafle/openapi-generator-original
add support for python2
This commit is contained in:
parent
3e13f69b53
commit
38903aa7f3
@ -25,6 +25,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
public static final String CONTROLLER_PACKAGE = "controllerPackage";
|
||||
public static final String DEFAULT_CONTROLLER = "defaultController";
|
||||
public static final String SUPPORT_PYTHON2= "supportPython2";
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected int serverPort = 8080;
|
||||
@ -105,11 +106,17 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
||||
"",
|
||||
"README.md")
|
||||
);
|
||||
supportingFiles.add(new SupportingFile("__init__.mustache",
|
||||
"",
|
||||
"__init__.py")
|
||||
);
|
||||
|
||||
cliOptions.add(new CliOption(CONTROLLER_PACKAGE, "controller package").
|
||||
defaultValue("controllers"));
|
||||
cliOptions.add(new CliOption(DEFAULT_CONTROLLER, "default controller").
|
||||
defaultValue("default_controller"));
|
||||
cliOptions.add(new CliOption(SUPPORT_PYTHON2, "support python2").
|
||||
defaultValue("false"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,6 +131,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
||||
this.controllerPackage = "controllers";
|
||||
additionalProperties.put(CONTROLLER_PACKAGE, this.controllerPackage);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(DEFAULT_CONTROLLER)) {
|
||||
this.defaultController = additionalProperties.get(DEFAULT_CONTROLLER).toString();
|
||||
}
|
||||
@ -132,11 +140,19 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
||||
additionalProperties.put(DEFAULT_CONTROLLER, this.defaultController);
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(additionalProperties.get(SUPPORT_PYTHON2))) {
|
||||
additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE);
|
||||
}
|
||||
|
||||
if(!new java.io.File(controllerPackage + File.separator + defaultController + ".py").exists()) {
|
||||
supportingFiles.add(new SupportingFile("controller.mustache",
|
||||
controllerPackage,
|
||||
defaultController + ".py")
|
||||
);
|
||||
supportingFiles.add(new SupportingFile("__init__.mustache",
|
||||
controllerPackage,
|
||||
"__init__.py")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
def {{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> str:
|
||||
def {{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{^supportPython2}} -> str{{/supportPython2}}:
|
||||
return 'do some magic!'
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
{{/apiInfo}}
|
||||
|
@ -4,5 +4,5 @@ import connexion
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
||||
app.add_api('swagger.yaml', arguments={'title': '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.'})
|
||||
app.add_api('swagger.yaml', arguments={'title': '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'})
|
||||
app.run(port=8080)
|
||||
|
@ -1,46 +1,13 @@
|
||||
|
||||
def create_user(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_users_with_array_input(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_users_with_list_input(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def login_user(username, password) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def logout_user() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_user_by_name(username) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_user(username, body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_user(username) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_inventory() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def place_order(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_order_by_id(orderId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_order(orderId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_pet(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def add_pet(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def add_pet_using_byte_array(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_pet(petId, apiKey) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def find_pets_by_status(status) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
@ -50,11 +17,59 @@ def find_pets_by_tags(tags) -> str:
|
||||
def get_pet_by_id(petId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_pet_with_form(petId, name, status) -> str:
|
||||
def get_pet_by_id_in_object(petId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_pet(petId, apiKey) -> str:
|
||||
def pet_pet_idtesting_byte_arraytrue_get(petId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_pet(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_pet_with_form(petId, name, status) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def upload_file(petId, additionalMetadata, file) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_order(orderId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def find_orders_by_status(status) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_inventory() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_inventory_in_object() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_order_by_id(orderId) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def place_order(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_user(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_users_with_array_input(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def create_users_with_list_input(body) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def delete_user(username) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def get_user_by_name(username) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def login_user(username, password) -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def logout_user() -> str:
|
||||
return 'do some magic!'
|
||||
|
||||
def update_user(username, body) -> str:
|
||||
return 'do some magic!'
|
||||
|
@ -2,9 +2,9 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
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."
|
||||
\ 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"
|
||||
version: "1.0.0"
|
||||
title: "Swagger Petstore"
|
||||
termsOfService: "http://swagger.io/terms/"
|
||||
@ -15,19 +15,6 @@ info:
|
||||
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
host: "petstore.swagger.io"
|
||||
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:
|
||||
- "http"
|
||||
paths:
|
||||
@ -42,18 +29,22 @@ paths:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Pet object that needs to be added to the store"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/Pet"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
put:
|
||||
@ -66,13 +57,13 @@ paths:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Pet object that needs to be added to the store"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/Pet"
|
||||
responses:
|
||||
@ -82,6 +73,10 @@ paths:
|
||||
description: "Pet not found"
|
||||
405:
|
||||
description: "Validation exception"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/findByStatus:
|
||||
@ -92,13 +87,13 @@ paths:
|
||||
description: "Multiple status values can be provided with comma separated strings"
|
||||
operationId: "controllers.default_controller.find_pets_by_status"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "status"
|
||||
in: "query"
|
||||
description: "Status values that need to be considered for filter"
|
||||
required: true
|
||||
description: "Status values that need to be considered for query"
|
||||
required: false
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
@ -106,8 +101,12 @@ paths:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
default: "available"
|
||||
collectionFormat: "multi"
|
||||
default: "available"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -117,6 +116,10 @@ paths:
|
||||
$ref: "#/definitions/Pet"
|
||||
400:
|
||||
description: "Invalid status value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/findByTags:
|
||||
@ -124,17 +127,17 @@ paths:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Finds Pets by tags"
|
||||
description: "Muliple tags can be provided with comma separated strings. Use\
|
||||
description: "Muliple tags can be provided with comma seperated strings. Use\
|
||||
\ tag1, tag2, tag3 for testing."
|
||||
operationId: "controllers.default_controller.find_pets_by_tags"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "tags"
|
||||
in: "query"
|
||||
description: "Tags to filter by"
|
||||
required: true
|
||||
required: false
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
@ -148,7 +151,10 @@ paths:
|
||||
$ref: "#/definitions/Pet"
|
||||
400:
|
||||
description: "Invalid tag value"
|
||||
deprecated: true
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/{petId}:
|
||||
@ -156,15 +162,16 @@ paths:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Find pet by ID"
|
||||
description: "Returns a single pet"
|
||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
||||
\ API error conditions"
|
||||
operationId: "controllers.default_controller.get_pet_by_id"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet to return"
|
||||
description: "ID of pet that needs to be fetched"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
@ -179,6 +186,9 @@ paths:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
post:
|
||||
@ -190,15 +200,14 @@ paths:
|
||||
consumes:
|
||||
- "application/x-www-form-urlencoded"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet that needs to be updated"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
type: "string"
|
||||
- name: "name"
|
||||
in: "formData"
|
||||
description: "Updated name of the pet"
|
||||
@ -212,6 +221,10 @@ paths:
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
delete:
|
||||
@ -221,11 +234,12 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.delete_pet"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "api_key"
|
||||
in: "header"
|
||||
description: ""
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "petId"
|
||||
@ -236,9 +250,11 @@ paths:
|
||||
format: "int64"
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
description: "Invalid pet value"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/{petId}/uploadImage:
|
||||
@ -252,6 +268,7 @@ paths:
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
@ -269,13 +286,151 @@ paths:
|
||||
description: "file to upload"
|
||||
required: false
|
||||
type: "file"
|
||||
responses:
|
||||
default:
|
||||
description: "successful operation"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/{petId}?response=inline_arbitrary_object:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Fake endpoint to test inline arbitrary object return by 'Find pet\
|
||||
\ by ID'"
|
||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
||||
\ API error conditions"
|
||||
operationId: "controllers.default_controller.get_pet_by_id_in_object"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet that needs to be fetched"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
$ref: "#/definitions/ApiResponse"
|
||||
$ref: "#/definitions/inline_response_200"
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet/{petId}?testing_byte_array=true:
|
||||
get:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Fake endpoint to test byte array return by 'Find pet by ID'"
|
||||
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
|
||||
\ API error conditions"
|
||||
operationId: "controllers.default_controller.pet_pet_idtesting_byte_arraytrue_get"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "petId"
|
||||
in: "path"
|
||||
description: "ID of pet that needs to be fetched"
|
||||
required: true
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Pet not found"
|
||||
security:
|
||||
- api_key: []
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/pet?testing_byte_array=true:
|
||||
post:
|
||||
tags:
|
||||
- "pet"
|
||||
summary: "Fake endpoint to test byte array in body parameter for adding a new\
|
||||
\ pet to the store"
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.add_pet_using_byte_array"
|
||||
consumes:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Pet object in the form of byte array"
|
||||
required: false
|
||||
schema:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
responses:
|
||||
405:
|
||||
description: "Invalid input"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- "write:pets"
|
||||
- "read:pets"
|
||||
x-tags:
|
||||
- tag: "pet"
|
||||
/store/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Finds orders by status"
|
||||
description: "A single status value can be provided as a string"
|
||||
operationId: "controllers.default_controller.find_orders_by_status"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "status"
|
||||
in: "query"
|
||||
description: "Status value that needs to be considered for query"
|
||||
required: false
|
||||
type: "string"
|
||||
default: "placed"
|
||||
enum:
|
||||
- "placed"
|
||||
- "approved"
|
||||
- "delivered"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Order"
|
||||
400:
|
||||
description: "Invalid status value"
|
||||
security:
|
||||
- test_api_client_secret: []
|
||||
test_api_client_id: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
@ -285,6 +440,7 @@ paths:
|
||||
operationId: "controllers.default_controller.get_inventory"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
@ -298,6 +454,28 @@ paths:
|
||||
- api_key: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/inventory?response=arbitrary_object:
|
||||
get:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Fake endpoint to test arbitrary object return by 'Get inventory'"
|
||||
description: "Returns an arbitrary object which is actually a map of status\
|
||||
\ codes to quantities"
|
||||
operationId: "controllers.default_controller.get_inventory_in_object"
|
||||
produces:
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
type: "object"
|
||||
properties: {}
|
||||
security:
|
||||
- api_key: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
@ -306,13 +484,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.place_order"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "order placed for purchasing the pet"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/Order"
|
||||
responses:
|
||||
@ -322,6 +500,9 @@ paths:
|
||||
$ref: "#/definitions/Order"
|
||||
400:
|
||||
description: "Invalid Order"
|
||||
security:
|
||||
- test_api_client_secret: []
|
||||
test_api_client_id: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
/store/order/{orderId}:
|
||||
@ -329,21 +510,18 @@ paths:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Find purchase order by ID"
|
||||
description: "For valid response try integer IDs with value >= 1 and <= 10.\
|
||||
\ Other values will generated exceptions"
|
||||
description: "For valid response try integer IDs with value <= 5 or > 10. Other\
|
||||
\ values will generated exceptions"
|
||||
operationId: "controllers.default_controller.get_order_by_id"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "orderId"
|
||||
in: "path"
|
||||
description: "ID of pet that needs to be fetched"
|
||||
required: true
|
||||
type: "integer"
|
||||
maximum: 10.0
|
||||
minimum: 1.0
|
||||
format: "int64"
|
||||
type: "string"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
@ -353,26 +531,27 @@ paths:
|
||||
description: "Invalid ID supplied"
|
||||
404:
|
||||
description: "Order not found"
|
||||
security:
|
||||
- test_api_key_header: []
|
||||
- test_api_key_query: []
|
||||
x-tags:
|
||||
- tag: "store"
|
||||
delete:
|
||||
tags:
|
||||
- "store"
|
||||
summary: "Delete purchase order by ID"
|
||||
description: "For valid response try integer IDs with positive integer value.\
|
||||
\ Negative or non-integer values will generate API errors"
|
||||
description: "For valid response try integer IDs with value < 1000. Anything\
|
||||
\ above 1000 or nonintegers will generate API errors"
|
||||
operationId: "controllers.default_controller.delete_order"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "orderId"
|
||||
in: "path"
|
||||
description: "ID of the order that needs to be deleted"
|
||||
required: true
|
||||
type: "integer"
|
||||
minimum: 1.0
|
||||
format: "int64"
|
||||
type: "string"
|
||||
responses:
|
||||
400:
|
||||
description: "Invalid ID supplied"
|
||||
@ -388,13 +567,13 @@ paths:
|
||||
description: "This can only be done by the logged in user."
|
||||
operationId: "controllers.default_controller.create_user"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Created user object"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
responses:
|
||||
@ -410,13 +589,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.create_users_with_array_input"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "List of user object"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
@ -434,13 +613,13 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.create_users_with_list_input"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "List of user object"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
type: "array"
|
||||
items:
|
||||
@ -458,33 +637,24 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.login_user"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "query"
|
||||
description: "The user name for login"
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
- name: "password"
|
||||
in: "query"
|
||||
description: "The password for login in clear text"
|
||||
required: true
|
||||
required: false
|
||||
type: "string"
|
||||
responses:
|
||||
200:
|
||||
description: "successful operation"
|
||||
schema:
|
||||
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 token expires"
|
||||
400:
|
||||
description: "Invalid username/password supplied"
|
||||
x-tags:
|
||||
@ -497,8 +667,8 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.logout_user"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters: []
|
||||
responses:
|
||||
default:
|
||||
@ -513,8 +683,8 @@ paths:
|
||||
description: ""
|
||||
operationId: "controllers.default_controller.get_user_by_name"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
@ -526,6 +696,16 @@ 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:
|
||||
@ -539,18 +719,18 @@ paths:
|
||||
description: "This can only be done by the logged in user."
|
||||
operationId: "controllers.default_controller.update_user"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
description: "name that need to be updated"
|
||||
description: "name that need to be deleted"
|
||||
required: true
|
||||
type: "string"
|
||||
- in: "body"
|
||||
name: "body"
|
||||
description: "Updated user object"
|
||||
required: true
|
||||
required: false
|
||||
schema:
|
||||
$ref: "#/definitions/User"
|
||||
responses:
|
||||
@ -567,8 +747,8 @@ paths:
|
||||
description: "This can only be done by the logged in user."
|
||||
operationId: "controllers.default_controller.delete_user"
|
||||
produces:
|
||||
- "application/xml"
|
||||
- "application/json"
|
||||
- "application/xml"
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
@ -580,43 +760,42 @@ paths:
|
||||
description: "Invalid username supplied"
|
||||
404:
|
||||
description: "User not found"
|
||||
security:
|
||||
- test_http_basic: []
|
||||
x-tags:
|
||||
- tag: "user"
|
||||
securityDefinitions:
|
||||
test_api_key_header:
|
||||
type: "apiKey"
|
||||
name: "test_api_key_header"
|
||||
in: "header"
|
||||
api_key:
|
||||
type: "apiKey"
|
||||
name: "api_key"
|
||||
in: "header"
|
||||
test_http_basic:
|
||||
type: "basic"
|
||||
test_api_client_secret:
|
||||
type: "apiKey"
|
||||
name: "x-test_api_client_secret"
|
||||
in: "header"
|
||||
test_api_client_id:
|
||||
type: "apiKey"
|
||||
name: "x-test_api_client_id"
|
||||
in: "header"
|
||||
test_api_key_query:
|
||||
type: "apiKey"
|
||||
name: "test_api_key_query"
|
||||
in: "query"
|
||||
petstore_auth:
|
||||
type: "oauth2"
|
||||
authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
|
||||
flow: "implicit"
|
||||
scopes:
|
||||
write:pets: "modify pets in your account"
|
||||
read:pets: "read your pets"
|
||||
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"
|
||||
User:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -640,7 +819,6 @@ definitions:
|
||||
xml:
|
||||
name: "User"
|
||||
Category:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
@ -649,28 +827,7 @@ definitions:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Category"
|
||||
Tag:
|
||||
type: "object"
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Tag"
|
||||
ApiResponse:
|
||||
type: "object"
|
||||
properties:
|
||||
code:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
type:
|
||||
type: "string"
|
||||
message:
|
||||
type: "string"
|
||||
Pet:
|
||||
type: "object"
|
||||
required:
|
||||
- "name"
|
||||
- "photoUrls"
|
||||
@ -706,6 +863,163 @@ definitions:
|
||||
- "sold"
|
||||
xml:
|
||||
name: "Pet"
|
||||
externalDocs:
|
||||
description: "Find out more about Swagger"
|
||||
url: "http://swagger.io"
|
||||
Tag:
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
name:
|
||||
type: "string"
|
||||
xml:
|
||||
name: "Tag"
|
||||
Order:
|
||||
properties:
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
readOnly: true
|
||||
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"
|
||||
xml:
|
||||
name: "Order"
|
||||
$special[model.name]:
|
||||
properties:
|
||||
$special[property.name]:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
xml:
|
||||
name: "$special[model.name]"
|
||||
Return:
|
||||
properties:
|
||||
return:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "Model for testing reserved words"
|
||||
xml:
|
||||
name: "Return"
|
||||
Name:
|
||||
required:
|
||||
- "name"
|
||||
properties:
|
||||
name:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
snake_case:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
readOnly: true
|
||||
description: "Model for testing model name same as property name"
|
||||
xml:
|
||||
name: "Name"
|
||||
200_response:
|
||||
properties:
|
||||
name:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
description: "Model for testing model name starting with number"
|
||||
xml:
|
||||
name: "Name"
|
||||
Dog:
|
||||
allOf:
|
||||
- $ref: "#/definitions/Animal"
|
||||
- type: "object"
|
||||
properties:
|
||||
breed:
|
||||
type: "string"
|
||||
Cat:
|
||||
allOf:
|
||||
- $ref: "#/definitions/Animal"
|
||||
- type: "object"
|
||||
properties:
|
||||
declawed:
|
||||
type: "boolean"
|
||||
Animal:
|
||||
type: "object"
|
||||
required:
|
||||
- "className"
|
||||
discriminator: "className"
|
||||
properties:
|
||||
className:
|
||||
type: "string"
|
||||
format_test:
|
||||
type: "object"
|
||||
required:
|
||||
- "number"
|
||||
properties:
|
||||
integer:
|
||||
type: "integer"
|
||||
int32:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
int64:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
number:
|
||||
type: "number"
|
||||
float:
|
||||
type: "number"
|
||||
format: "float"
|
||||
double:
|
||||
type: "number"
|
||||
format: "double"
|
||||
string:
|
||||
type: "string"
|
||||
byte:
|
||||
type: "string"
|
||||
format: "byte"
|
||||
binary:
|
||||
type: "string"
|
||||
format: "binary"
|
||||
date:
|
||||
type: "string"
|
||||
format: "date"
|
||||
dateTime:
|
||||
type: "string"
|
||||
format: "date-time"
|
||||
password:
|
||||
type: "string"
|
||||
format: "password"
|
||||
inline_response_200:
|
||||
required:
|
||||
- "id"
|
||||
properties:
|
||||
tags:
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Tag"
|
||||
id:
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
category:
|
||||
type: "object"
|
||||
properties: {}
|
||||
status:
|
||||
type: "string"
|
||||
description: "pet status in the store"
|
||||
enum:
|
||||
- "available"
|
||||
- "pending"
|
||||
- "sold"
|
||||
name:
|
||||
type: "string"
|
||||
example: "doggie"
|
||||
photoUrls:
|
||||
type: "array"
|
||||
items:
|
||||
type: "string"
|
||||
|
Loading…
x
Reference in New Issue
Block a user