mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
fix python flask parameter naming
This commit is contained in:
parent
4109f51a22
commit
9999eac528
@ -26,7 +26,7 @@ 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/openapi-generator/src/main/resources/flaskConnexion -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion -Dservice"
|
ags="generate -t modules/openapi-generator/src/main/resources/flaskConnexion -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l python-flask -o samples/server/petstore/flaskConnexion -Dservice $@"
|
||||||
|
|
||||||
rm -rf samples/server/petstore/flaskConnexion/*
|
rm -rf samples/server/petstore/flaskConnexion/*
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -4130,7 +4130,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenModel = fromModel(name, schema, schemas);
|
codegenModel = fromModel(name, schema, schemas);
|
||||||
}
|
}
|
||||||
if (codegenModel != null && !codegenModel.emptyVars) {
|
if (codegenModel != null && !codegenModel.emptyVars) {
|
||||||
codegenParameter.paramName = toParamName(codegenModel.name);
|
codegenParameter.paramName = toParamName(codegenModel.classname);
|
||||||
codegenParameter.baseType = codegenModel.classname;
|
codegenParameter.baseType = codegenModel.classname;
|
||||||
codegenParameter.dataType = getTypeDeclaration(codegenModel.classname);
|
codegenParameter.dataType = getTypeDeclaration(codegenModel.classname);
|
||||||
codegenParameter.description = codegenModel.description;
|
codegenParameter.description = codegenModel.description;
|
||||||
@ -4141,6 +4141,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenParameter.baseType = codegenProperty.baseType;
|
codegenParameter.baseType = codegenProperty.baseType;
|
||||||
codegenParameter.dataType = codegenProperty.datatype;
|
codegenParameter.dataType = codegenProperty.datatype;
|
||||||
codegenParameter.description = codegenProperty.description;
|
codegenParameter.description = codegenProperty.description;
|
||||||
|
codegenParameter.paramName = toParamName(codegenProperty.baseType);
|
||||||
|
|
||||||
if (codegenProperty.complexType != null) {
|
if (codegenProperty.complexType != null) {
|
||||||
imports.add(codegenProperty.complexType);
|
imports.add(codegenProperty.complexType);
|
||||||
|
@ -405,18 +405,13 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toParamName(String name) {
|
public String toParamName(String name) {
|
||||||
// don't do name =removeNonNameElementToCamelCase(name); // this breaks connexion, which does not modify param names before sending them
|
// to avoid conflicts with 'callback' parameter for async call
|
||||||
if (reservedWords.contains(name)) {
|
if ("callback".equals(name)) {
|
||||||
return escapeReservedWord(name);
|
return "param_callback";
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanitize the param name but don't underscore it since it's used for request mapping
|
// should be the same as variable name
|
||||||
String paramName = sanitizeName(name);
|
return toVarName(name);
|
||||||
if (!paramName.equals(name)) {
|
|
||||||
LOGGER.warn(name + " (parameter name) cannot be used as parameter name with flask-connexion and was sanitized as " + paramName);
|
|
||||||
}
|
|
||||||
// Param name is already sanitized in openapi spec processing
|
|
||||||
return paramName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.0-SNAPSHOT
|
3.0.0-SNAPSHOT
|
@ -27,7 +27,7 @@ http://localhost:8080/v2/ui/
|
|||||||
Your Swagger definition lives here:
|
Your Swagger definition lives here:
|
||||||
|
|
||||||
```
|
```
|
||||||
http://localhost:8080/v2/swagger.json
|
http://localhost:8080/v2/openapi.json
|
||||||
```
|
```
|
||||||
|
|
||||||
To launch the integration tests, use tox:
|
To launch the integration tests, use tox:
|
||||||
|
@ -21,10 +21,10 @@ setup(
|
|||||||
description="Swagger Petstore",
|
description="Swagger Petstore",
|
||||||
author_email="apiteam@swagger.io",
|
author_email="apiteam@swagger.io",
|
||||||
url="",
|
url="",
|
||||||
keywords=["Swagger", "Swagger Petstore"],
|
keywords=["OpenAPI", "Swagger Petstore"],
|
||||||
install_requires=REQUIRES,
|
install_requires=REQUIRES,
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
package_data={'': ['swagger/swagger.yaml']},
|
package_data={'': ['openapi/openapi.yaml']},
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': ['swagger_server=swagger_server.__main__:main']},
|
'console_scripts': ['swagger_server=swagger_server.__main__:main']},
|
||||||
|
@ -6,9 +6,9 @@ from swagger_server import encoder
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = connexion.App(__name__, specification_dir='./swagger/')
|
app = connexion.App(__name__, specification_dir='./openapi/')
|
||||||
app.app.json_encoder = encoder.JSONEncoder
|
app.app.json_encoder = encoder.JSONEncoder
|
||||||
app.add_api('swagger.yaml', arguments={'title': 'Swagger Petstore'})
|
app.add_api('openapi.yaml', arguments={'title': 'Swagger Petstore'})
|
||||||
app.run(port=8080)
|
app.run(port=8080)
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,28 +6,28 @@ from swagger_server.models.pet import Pet # noqa: E501
|
|||||||
from swagger_server import util
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
def add_pet(body): # noqa: E501
|
def add_pet(pet): # noqa: E501
|
||||||
"""Add a new pet to the store
|
"""Add a new pet to the store
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param body: Pet object that needs to be added to the store
|
:param pet: Pet object that needs to be added to the store
|
||||||
:type body: dict | bytes
|
:type pet: dict | bytes
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def delete_pet(petId, api_key=None): # noqa: E501
|
def delete_pet(pet_id, api_key=None): # noqa: E501
|
||||||
"""Deletes a pet
|
"""Deletes a pet
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param petId: Pet id to delete
|
:param pet_id: Pet id to delete
|
||||||
:type petId: int
|
:type pet_id: int
|
||||||
:param api_key:
|
:param api_key:
|
||||||
:type api_key: str
|
:type api_key: str
|
||||||
|
|
||||||
@ -62,41 +62,41 @@ def find_pets_by_tags(tags): # noqa: E501
|
|||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def get_pet_by_id(petId): # noqa: E501
|
def get_pet_by_id(pet_id): # noqa: E501
|
||||||
"""Find pet by ID
|
"""Find pet by ID
|
||||||
|
|
||||||
Returns a single pet # noqa: E501
|
Returns a single pet # noqa: E501
|
||||||
|
|
||||||
:param petId: ID of pet to return
|
:param pet_id: ID of pet to return
|
||||||
:type petId: int
|
:type pet_id: int
|
||||||
|
|
||||||
:rtype: Pet
|
:rtype: Pet
|
||||||
"""
|
"""
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def update_pet(body): # noqa: E501
|
def update_pet(pet): # noqa: E501
|
||||||
"""Update an existing pet
|
"""Update an existing pet
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param body: Pet object that needs to be added to the store
|
:param pet: Pet object that needs to be added to the store
|
||||||
:type body: dict | bytes
|
:type pet: dict | bytes
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def update_pet_with_form(petId, name=None, status=None): # noqa: E501
|
def update_pet_with_form(pet_id, name=None, status=None): # noqa: E501
|
||||||
"""Updates a pet in the store with form data
|
"""Updates a pet in the store with form data
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param petId: ID of pet that needs to be updated
|
:param pet_id: ID of pet that needs to be updated
|
||||||
:type petId: int
|
:type pet_id: int
|
||||||
:param name: Updated name of the pet
|
:param name: Updated name of the pet
|
||||||
:type name: str
|
:type name: str
|
||||||
:param status: Updated status of the pet
|
:param status: Updated status of the pet
|
||||||
@ -107,17 +107,17 @@ def update_pet_with_form(petId, name=None, status=None): # noqa: E501
|
|||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def upload_file(petId, additionalMetadata=None, file=None): # noqa: E501
|
def upload_file(pet_id, additional_metadata=None, file=None): # noqa: E501
|
||||||
"""uploads an image
|
"""uploads an image
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param petId: ID of pet to update
|
:param pet_id: ID of pet to update
|
||||||
:type petId: int
|
:type pet_id: int
|
||||||
:param additionalMetadata: Additional data to pass to server
|
:param additional_metadata: Additional data to pass to server
|
||||||
:type additionalMetadata: str
|
:type additional_metadata: str
|
||||||
:param file: file to upload
|
:param file: file to upload
|
||||||
:type file: werkzeug.datastructures.FileStorage
|
:type file: str
|
||||||
|
|
||||||
:rtype: ApiResponse
|
:rtype: ApiResponse
|
||||||
"""
|
"""
|
||||||
|
@ -5,13 +5,13 @@ from swagger_server.models.order import Order # noqa: E501
|
|||||||
from swagger_server import util
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
def delete_order(orderId): # noqa: E501
|
def delete_order(order_id): # noqa: E501
|
||||||
"""Delete purchase order by ID
|
"""Delete purchase order by ID
|
||||||
|
|
||||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
|
||||||
|
|
||||||
:param orderId: ID of the order that needs to be deleted
|
:param order_id: ID of the order that needs to be deleted
|
||||||
:type orderId: str
|
:type order_id: str
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
@ -29,29 +29,29 @@ def get_inventory(): # noqa: E501
|
|||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def get_order_by_id(orderId): # noqa: E501
|
def get_order_by_id(order_id): # noqa: E501
|
||||||
"""Find purchase order by ID
|
"""Find purchase order by ID
|
||||||
|
|
||||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
|
||||||
|
|
||||||
:param orderId: ID of pet that needs to be fetched
|
:param order_id: ID of pet that needs to be fetched
|
||||||
:type orderId: int
|
:type order_id: int
|
||||||
|
|
||||||
:rtype: Order
|
:rtype: Order
|
||||||
"""
|
"""
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def place_order(body): # noqa: E501
|
def place_order(order): # noqa: E501
|
||||||
"""Place an order for a pet
|
"""Place an order for a pet
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param body: order placed for purchasing the pet
|
:param order: order placed for purchasing the pet
|
||||||
:type body: dict | bytes
|
:type order: dict | bytes
|
||||||
|
|
||||||
:rtype: Order
|
:rtype: Order
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
order = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
@ -5,48 +5,48 @@ from swagger_server.models.user import User # noqa: E501
|
|||||||
from swagger_server import util
|
from swagger_server import util
|
||||||
|
|
||||||
|
|
||||||
def create_user(body): # noqa: E501
|
def create_user(user): # noqa: E501
|
||||||
"""Create user
|
"""Create user
|
||||||
|
|
||||||
This can only be done by the logged in user. # noqa: E501
|
This can only be done by the logged in user. # noqa: E501
|
||||||
|
|
||||||
:param body: Created user object
|
:param user: Created user object
|
||||||
:type body: dict | bytes
|
:type user: dict | bytes
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def create_users_with_array_input(body): # noqa: E501
|
def create_users_with_array_input(user): # noqa: E501
|
||||||
"""Creates list of users with given input array
|
"""Creates list of users with given input array
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param body: List of user object
|
:param user: List of user object
|
||||||
:type body: list | bytes
|
:type user: list | bytes
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def create_users_with_list_input(body): # noqa: E501
|
def create_users_with_list_input(user): # noqa: E501
|
||||||
"""Creates list of users with given input array
|
"""Creates list of users with given input array
|
||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param body: List of user object
|
:param user: List of user object
|
||||||
:type body: list | bytes
|
:type user: list | bytes
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ def get_user_by_name(username): # noqa: E501
|
|||||||
|
|
||||||
# noqa: E501
|
# noqa: E501
|
||||||
|
|
||||||
:param username: The name that needs to be fetched. Use user1 for testing.
|
:param username: The name that needs to be fetched. Use user1 for testing.
|
||||||
:type username: str
|
:type username: str
|
||||||
|
|
||||||
:rtype: User
|
:rtype: User
|
||||||
@ -102,18 +102,18 @@ def logout_user(): # noqa: E501
|
|||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
|
||||||
|
|
||||||
def update_user(username, body): # noqa: E501
|
def update_user(username, user): # noqa: E501
|
||||||
"""Updated user
|
"""Updated user
|
||||||
|
|
||||||
This can only be done by the logged in user. # noqa: E501
|
This can only be done by the logged in user. # noqa: E501
|
||||||
|
|
||||||
:param username: name that need to be deleted
|
:param username: name that need to be deleted
|
||||||
:type username: str
|
:type username: str
|
||||||
:param body: Updated user object
|
:param user: Updated user object
|
||||||
:type body: dict | bytes
|
:type user: dict | bytes
|
||||||
|
|
||||||
:rtype: None
|
:rtype: None
|
||||||
"""
|
"""
|
||||||
if connexion.request.is_json:
|
if connexion.request.is_json:
|
||||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||||
return 'do some magic!'
|
return 'do some magic!'
|
||||||
|
@ -0,0 +1,742 @@
|
|||||||
|
openapi: 3.0.1
|
||||||
|
info:
|
||||||
|
title: Swagger Petstore
|
||||||
|
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.'
|
||||||
|
termsOfService: http://swagger.io/terms/
|
||||||
|
contact:
|
||||||
|
email: apiteam@swagger.io
|
||||||
|
license:
|
||||||
|
name: Apache-2.0
|
||||||
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
version: 1.0.0
|
||||||
|
externalDocs:
|
||||||
|
description: Find out more about Swagger
|
||||||
|
url: http://swagger.io
|
||||||
|
servers:
|
||||||
|
- url: http://petstore.swagger.io/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
|
||||||
|
paths:
|
||||||
|
/pet:
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Update an existing pet
|
||||||
|
operationId: update_pet
|
||||||
|
requestBody:
|
||||||
|
description: Pet object that needs to be added to the store
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: Pet not found
|
||||||
|
content: {}
|
||||||
|
405:
|
||||||
|
description: Validation exception
|
||||||
|
content: {}
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Add a new pet to the store
|
||||||
|
operationId: add_pet
|
||||||
|
requestBody:
|
||||||
|
description: Pet object that needs to be added to the store
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
405:
|
||||||
|
description: Invalid input
|
||||||
|
content: {}
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
/pet/findByStatus:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Finds Pets by status
|
||||||
|
description: Multiple status values can be provided with comma separated strings
|
||||||
|
operationId: find_pets_by_status
|
||||||
|
parameters:
|
||||||
|
- name: status
|
||||||
|
in: query
|
||||||
|
description: Status values that need to be considered for filter
|
||||||
|
required: true
|
||||||
|
explode: false
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
default: available
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
400:
|
||||||
|
description: Invalid status value
|
||||||
|
content: {}
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
/pet/findByTags:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Finds Pets by tags
|
||||||
|
description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
operationId: find_pets_by_tags
|
||||||
|
parameters:
|
||||||
|
- name: tags
|
||||||
|
in: query
|
||||||
|
description: Tags to filter by
|
||||||
|
required: true
|
||||||
|
explode: false
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
400:
|
||||||
|
description: Invalid tag value
|
||||||
|
content: {}
|
||||||
|
deprecated: true
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
/pet/{petId}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Find pet by ID
|
||||||
|
description: Returns a single pet
|
||||||
|
operationId: get_pet_by_id
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet to return
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: Pet not found
|
||||||
|
content: {}
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Updates a pet in the store with form data
|
||||||
|
operationId: update_pet_with_form
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet that needs to be updated
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Updated name of the pet
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
description: Updated status of the pet
|
||||||
|
responses:
|
||||||
|
405:
|
||||||
|
description: Invalid input
|
||||||
|
content: {}
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: Deletes a pet
|
||||||
|
operationId: delete_pet
|
||||||
|
parameters:
|
||||||
|
- name: api_key
|
||||||
|
in: header
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: Pet id to delete
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid pet value
|
||||||
|
content: {}
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
/pet/{petId}/uploadImage:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- pet
|
||||||
|
summary: uploads an image
|
||||||
|
operationId: upload_file
|
||||||
|
parameters:
|
||||||
|
- name: petId
|
||||||
|
in: path
|
||||||
|
description: ID of pet to update
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
multipart/form-data:
|
||||||
|
schema:
|
||||||
|
properties:
|
||||||
|
additionalMetadata:
|
||||||
|
type: string
|
||||||
|
description: Additional data to pass to server
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
description: file to upload
|
||||||
|
format: binary
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/ApiResponse'
|
||||||
|
security:
|
||||||
|
- petstore_auth:
|
||||||
|
- write:pets
|
||||||
|
- read:pets
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.pet_controller
|
||||||
|
/store/inventory:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Returns pet inventories by status
|
||||||
|
description: Returns a map of status codes to quantities
|
||||||
|
operationId: get_inventory
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
security:
|
||||||
|
- api_key: []
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.store_controller
|
||||||
|
/store/order:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Place an order for a pet
|
||||||
|
operationId: place_order
|
||||||
|
requestBody:
|
||||||
|
description: order placed for purchasing the pet
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
400:
|
||||||
|
description: Invalid Order
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.store_controller
|
||||||
|
/store/order/{orderId}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Find purchase order by ID
|
||||||
|
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
operationId: get_order_by_id
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
description: ID of pet that needs to be fetched
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
maximum: 5
|
||||||
|
minimum: 1
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Order'
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: Order not found
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.store_controller
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- store
|
||||||
|
summary: Delete purchase order by ID
|
||||||
|
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
operationId: delete_order
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
description: ID of the order that needs to be deleted
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid ID supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: Order not found
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.store_controller
|
||||||
|
/user:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Create user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: create_user
|
||||||
|
requestBody:
|
||||||
|
description: Created user object
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
/user/createWithArray:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Creates list of users with given input array
|
||||||
|
operationId: create_users_with_array_input
|
||||||
|
requestBody:
|
||||||
|
description: List of user object
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
/user/createWithList:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Creates list of users with given input array
|
||||||
|
operationId: create_users_with_list_input
|
||||||
|
requestBody:
|
||||||
|
description: List of user object
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
/user/login:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Logs user into the system
|
||||||
|
operationId: login_user
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: query
|
||||||
|
description: The user name for login
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: password
|
||||||
|
in: query
|
||||||
|
description: The password for login in clear text
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
headers:
|
||||||
|
X-Rate-Limit:
|
||||||
|
description: calls per hour allowed by the user
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
X-Expires-After:
|
||||||
|
description: date in UTC when toekn expires
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
400:
|
||||||
|
description: Invalid username/password supplied
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
/user/logout:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Logs out current logged in user session
|
||||||
|
operationId: logout_user
|
||||||
|
responses:
|
||||||
|
default:
|
||||||
|
description: successful operation
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
/user/{username}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Get user by user name
|
||||||
|
operationId: get_user_by_name
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: The name that needs to be fetched. Use user1 for testing.
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: successful operation
|
||||||
|
content:
|
||||||
|
application/xml:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
400:
|
||||||
|
description: Invalid username supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: User not found
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Updated user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: update_user
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: name that need to be deleted
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
requestBody:
|
||||||
|
description: Updated user object
|
||||||
|
content:
|
||||||
|
'*/*':
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
required: true
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid user supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: User not found
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
delete:
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
summary: Delete user
|
||||||
|
description: This can only be done by the logged in user.
|
||||||
|
operationId: delete_user
|
||||||
|
parameters:
|
||||||
|
- name: username
|
||||||
|
in: path
|
||||||
|
description: The name that needs to be deleted
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
400:
|
||||||
|
description: Invalid username supplied
|
||||||
|
content: {}
|
||||||
|
404:
|
||||||
|
description: User not found
|
||||||
|
content: {}
|
||||||
|
x-swagger-router-controller: swagger_server.controllers.user_controller
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
Order:
|
||||||
|
title: Pet 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
|
||||||
|
description: An order for a pets from the pet store
|
||||||
|
xml:
|
||||||
|
name: Order
|
||||||
|
Category:
|
||||||
|
title: Pet category
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: A category for a pet
|
||||||
|
xml:
|
||||||
|
name: Category
|
||||||
|
User:
|
||||||
|
title: a User
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
firstName:
|
||||||
|
type: string
|
||||||
|
lastName:
|
||||||
|
type: string
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
phone:
|
||||||
|
type: string
|
||||||
|
userStatus:
|
||||||
|
type: integer
|
||||||
|
description: User Status
|
||||||
|
format: int32
|
||||||
|
description: A User who is purchasing from the pet store
|
||||||
|
xml:
|
||||||
|
name: User
|
||||||
|
Tag:
|
||||||
|
title: Pet Tag
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: A tag for a pet
|
||||||
|
xml:
|
||||||
|
name: Tag
|
||||||
|
Pet:
|
||||||
|
title: a Pet
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
- photoUrls
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
category:
|
||||||
|
$ref: '#/components/schemas/Category'
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: doggie
|
||||||
|
photoUrls:
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
name: photoUrl
|
||||||
|
wrapped: true
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
tags:
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
name: tag
|
||||||
|
wrapped: true
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Tag'
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
description: pet status in the store
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
description: A pet for sale in the pet store
|
||||||
|
xml:
|
||||||
|
name: Pet
|
||||||
|
ApiResponse:
|
||||||
|
title: An uploaded response
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
description: Describes the result of uploading an image resource
|
||||||
|
securitySchemes:
|
||||||
|
petstore_auth:
|
||||||
|
type: oauth2
|
||||||
|
flows:
|
||||||
|
implicit:
|
||||||
|
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
|
||||||
|
scopes:
|
||||||
|
write:pets: modify pets in your account
|
||||||
|
read:pets: read your pets
|
||||||
|
api_key:
|
||||||
|
type: apiKey
|
||||||
|
name: api_key
|
||||||
|
in: header
|
@ -1,775 +0,0 @@
|
|||||||
---
|
|
||||||
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."
|
|
||||||
version: "1.0.0"
|
|
||||||
title: "Swagger Petstore"
|
|
||||||
termsOfService: "http://swagger.io/terms/"
|
|
||||||
contact:
|
|
||||||
email: "apiteam@swagger.io"
|
|
||||||
license:
|
|
||||||
name: "Apache-2.0"
|
|
||||||
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:
|
|
||||||
/pet:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Add a new pet to the store"
|
|
||||||
description: ""
|
|
||||||
operationId: "add_pet"
|
|
||||||
consumes:
|
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "Pet object that needs to be added to the store"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
responses:
|
|
||||||
405:
|
|
||||||
description: "Invalid input"
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- "write:pets"
|
|
||||||
- "read:pets"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
put:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Update an existing pet"
|
|
||||||
description: ""
|
|
||||||
operationId: "update_pet"
|
|
||||||
consumes:
|
|
||||||
- "application/json"
|
|
||||||
- "application/xml"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "Pet object that needs to be added to the store"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
responses:
|
|
||||||
400:
|
|
||||||
description: "Invalid ID supplied"
|
|
||||||
404:
|
|
||||||
description: "Pet not found"
|
|
||||||
405:
|
|
||||||
description: "Validation exception"
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- "write:pets"
|
|
||||||
- "read:pets"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
/pet/findByStatus:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Finds Pets by status"
|
|
||||||
description: "Multiple status values can be provided with comma separated strings"
|
|
||||||
operationId: "find_pets_by_status"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "status"
|
|
||||||
in: "query"
|
|
||||||
description: "Status values that need to be considered for filter"
|
|
||||||
required: true
|
|
||||||
type: "array"
|
|
||||||
items:
|
|
||||||
type: "string"
|
|
||||||
default: "available"
|
|
||||||
enum:
|
|
||||||
- "available"
|
|
||||||
- "pending"
|
|
||||||
- "sold"
|
|
||||||
collectionFormat: "csv"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
type: "array"
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
400:
|
|
||||||
description: "Invalid status value"
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- "write:pets"
|
|
||||||
- "read:pets"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
/pet/findByTags:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Finds Pets by tags"
|
|
||||||
description: "Multiple tags can be provided with comma separated strings. Use\
|
|
||||||
\ tag1, tag2, tag3 for testing."
|
|
||||||
operationId: "find_pets_by_tags"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "tags"
|
|
||||||
in: "query"
|
|
||||||
description: "Tags to filter by"
|
|
||||||
required: true
|
|
||||||
type: "array"
|
|
||||||
items:
|
|
||||||
type: "string"
|
|
||||||
collectionFormat: "csv"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
type: "array"
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
400:
|
|
||||||
description: "Invalid tag value"
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- "write:pets"
|
|
||||||
- "read:pets"
|
|
||||||
deprecated: true
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
/pet/{petId}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Find pet by ID"
|
|
||||||
description: "Returns a single pet"
|
|
||||||
operationId: "get_pet_by_id"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "petId"
|
|
||||||
in: "path"
|
|
||||||
description: "ID of pet to return"
|
|
||||||
required: true
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Pet"
|
|
||||||
400:
|
|
||||||
description: "Invalid ID supplied"
|
|
||||||
404:
|
|
||||||
description: "Pet not found"
|
|
||||||
security:
|
|
||||||
- api_key: []
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Updates a pet in the store with form data"
|
|
||||||
description: ""
|
|
||||||
operationId: "update_pet_with_form"
|
|
||||||
consumes:
|
|
||||||
- "application/x-www-form-urlencoded"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "petId"
|
|
||||||
in: "path"
|
|
||||||
description: "ID of pet that needs to be updated"
|
|
||||||
required: true
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
- name: "name"
|
|
||||||
in: "formData"
|
|
||||||
description: "Updated name of the pet"
|
|
||||||
required: false
|
|
||||||
type: "string"
|
|
||||||
- name: "status"
|
|
||||||
in: "formData"
|
|
||||||
description: "Updated status of the pet"
|
|
||||||
required: false
|
|
||||||
type: "string"
|
|
||||||
responses:
|
|
||||||
405:
|
|
||||||
description: "Invalid input"
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- "write:pets"
|
|
||||||
- "read:pets"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "Deletes a pet"
|
|
||||||
description: ""
|
|
||||||
operationId: "delete_pet"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "api_key"
|
|
||||||
in: "header"
|
|
||||||
required: false
|
|
||||||
type: "string"
|
|
||||||
- name: "petId"
|
|
||||||
in: "path"
|
|
||||||
description: "Pet id to delete"
|
|
||||||
required: true
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
responses:
|
|
||||||
400:
|
|
||||||
description: "Invalid pet value"
|
|
||||||
security:
|
|
||||||
- petstore_auth:
|
|
||||||
- "write:pets"
|
|
||||||
- "read:pets"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.pet_controller"
|
|
||||||
/pet/{petId}/uploadImage:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "pet"
|
|
||||||
summary: "uploads an image"
|
|
||||||
description: ""
|
|
||||||
operationId: "upload_file"
|
|
||||||
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: "swagger_server.controllers.pet_controller"
|
|
||||||
/store/inventory:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "store"
|
|
||||||
summary: "Returns pet inventories by status"
|
|
||||||
description: "Returns a map of status codes to quantities"
|
|
||||||
operationId: "get_inventory"
|
|
||||||
produces:
|
|
||||||
- "application/json"
|
|
||||||
parameters: []
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
type: "object"
|
|
||||||
additionalProperties:
|
|
||||||
type: "integer"
|
|
||||||
format: "int32"
|
|
||||||
security:
|
|
||||||
- api_key: []
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.store_controller"
|
|
||||||
/store/order:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "store"
|
|
||||||
summary: "Place an order for a pet"
|
|
||||||
description: ""
|
|
||||||
operationId: "place_order"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "order placed for purchasing the pet"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Order"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Order"
|
|
||||||
400:
|
|
||||||
description: "Invalid Order"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.store_controller"
|
|
||||||
/store/order/{orderId}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "store"
|
|
||||||
summary: "Find purchase order by ID"
|
|
||||||
description: "For valid response try integer IDs with value <= 5 or > 10. Other\
|
|
||||||
\ values will generated exceptions"
|
|
||||||
operationId: "get_order_by_id"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "orderId"
|
|
||||||
in: "path"
|
|
||||||
description: "ID of pet that needs to be fetched"
|
|
||||||
required: true
|
|
||||||
type: "integer"
|
|
||||||
maximum: 5
|
|
||||||
minimum: 1
|
|
||||||
format: "int64"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/Order"
|
|
||||||
400:
|
|
||||||
description: "Invalid ID supplied"
|
|
||||||
404:
|
|
||||||
description: "Order not found"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.store_controller"
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- "store"
|
|
||||||
summary: "Delete purchase order by ID"
|
|
||||||
description: "For valid response try integer IDs with value < 1000. Anything\
|
|
||||||
\ above 1000 or nonintegers will generate API errors"
|
|
||||||
operationId: "delete_order"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "orderId"
|
|
||||||
in: "path"
|
|
||||||
description: "ID of the order that needs to be deleted"
|
|
||||||
required: true
|
|
||||||
type: "string"
|
|
||||||
responses:
|
|
||||||
400:
|
|
||||||
description: "Invalid ID supplied"
|
|
||||||
404:
|
|
||||||
description: "Order not found"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.store_controller"
|
|
||||||
/user:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Create user"
|
|
||||||
description: "This can only be done by the logged in user."
|
|
||||||
operationId: "create_user"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "Created user object"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: "successful operation"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
/user/createWithArray:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Creates list of users with given input array"
|
|
||||||
description: ""
|
|
||||||
operationId: "create_users_with_array_input"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "List of user object"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: "array"
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: "successful operation"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
/user/createWithList:
|
|
||||||
post:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Creates list of users with given input array"
|
|
||||||
description: ""
|
|
||||||
operationId: "create_users_with_list_input"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "List of user object"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: "array"
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: "successful operation"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
/user/login:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Logs user into the system"
|
|
||||||
description: ""
|
|
||||||
operationId: "login_user"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "username"
|
|
||||||
in: "query"
|
|
||||||
description: "The user name for login"
|
|
||||||
required: true
|
|
||||||
type: "string"
|
|
||||||
- name: "password"
|
|
||||||
in: "query"
|
|
||||||
description: "The password for login in clear text"
|
|
||||||
required: true
|
|
||||||
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 toekn expires"
|
|
||||||
400:
|
|
||||||
description: "Invalid username/password supplied"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
/user/logout:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Logs out current logged in user session"
|
|
||||||
description: ""
|
|
||||||
operationId: "logout_user"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters: []
|
|
||||||
responses:
|
|
||||||
default:
|
|
||||||
description: "successful operation"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
/user/{username}:
|
|
||||||
get:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Get user by user name"
|
|
||||||
description: ""
|
|
||||||
operationId: "get_user_by_name"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "username"
|
|
||||||
in: "path"
|
|
||||||
description: "The name that needs to be fetched. Use user1 for testing. "
|
|
||||||
required: true
|
|
||||||
type: "string"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: "successful operation"
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
400:
|
|
||||||
description: "Invalid username supplied"
|
|
||||||
404:
|
|
||||||
description: "User not found"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
put:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Updated user"
|
|
||||||
description: "This can only be done by the logged in user."
|
|
||||||
operationId: "update_user"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "username"
|
|
||||||
in: "path"
|
|
||||||
description: "name that need to be deleted"
|
|
||||||
required: true
|
|
||||||
type: "string"
|
|
||||||
- in: "body"
|
|
||||||
name: "body"
|
|
||||||
description: "Updated user object"
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: "#/definitions/User"
|
|
||||||
responses:
|
|
||||||
400:
|
|
||||||
description: "Invalid user supplied"
|
|
||||||
404:
|
|
||||||
description: "User not found"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
delete:
|
|
||||||
tags:
|
|
||||||
- "user"
|
|
||||||
summary: "Delete user"
|
|
||||||
description: "This can only be done by the logged in user."
|
|
||||||
operationId: "delete_user"
|
|
||||||
produces:
|
|
||||||
- "application/xml"
|
|
||||||
- "application/json"
|
|
||||||
parameters:
|
|
||||||
- name: "username"
|
|
||||||
in: "path"
|
|
||||||
description: "The name that needs to be deleted"
|
|
||||||
required: true
|
|
||||||
type: "string"
|
|
||||||
responses:
|
|
||||||
400:
|
|
||||||
description: "Invalid username supplied"
|
|
||||||
404:
|
|
||||||
description: "User not found"
|
|
||||||
x-swagger-router-controller: "swagger_server.controllers.user_controller"
|
|
||||||
securityDefinitions:
|
|
||||||
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"
|
|
||||||
api_key:
|
|
||||||
type: "apiKey"
|
|
||||||
name: "api_key"
|
|
||||||
in: "header"
|
|
||||||
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
|
|
||||||
title: "Pet Order"
|
|
||||||
description: "An order for a pets from the pet store"
|
|
||||||
example:
|
|
||||||
petId: 6
|
|
||||||
quantity: 1
|
|
||||||
id: 0
|
|
||||||
shipDate: "2000-01-23T04:56:07.000+00:00"
|
|
||||||
complete: false
|
|
||||||
status: "placed"
|
|
||||||
xml:
|
|
||||||
name: "Order"
|
|
||||||
Category:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
name:
|
|
||||||
type: "string"
|
|
||||||
title: "Pet category"
|
|
||||||
description: "A category for a pet"
|
|
||||||
example:
|
|
||||||
name: "name"
|
|
||||||
id: 6
|
|
||||||
xml:
|
|
||||||
name: "Category"
|
|
||||||
User:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
username:
|
|
||||||
type: "string"
|
|
||||||
firstName:
|
|
||||||
type: "string"
|
|
||||||
lastName:
|
|
||||||
type: "string"
|
|
||||||
email:
|
|
||||||
type: "string"
|
|
||||||
password:
|
|
||||||
type: "string"
|
|
||||||
phone:
|
|
||||||
type: "string"
|
|
||||||
userStatus:
|
|
||||||
type: "integer"
|
|
||||||
format: "int32"
|
|
||||||
description: "User Status"
|
|
||||||
title: "a User"
|
|
||||||
description: "A User who is purchasing from the pet store"
|
|
||||||
example:
|
|
||||||
firstName: "firstName"
|
|
||||||
lastName: "lastName"
|
|
||||||
password: "password"
|
|
||||||
userStatus: 6
|
|
||||||
phone: "phone"
|
|
||||||
id: 0
|
|
||||||
email: "email"
|
|
||||||
username: "username"
|
|
||||||
xml:
|
|
||||||
name: "User"
|
|
||||||
Tag:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
name:
|
|
||||||
type: "string"
|
|
||||||
title: "Pet Tag"
|
|
||||||
description: "A tag for a pet"
|
|
||||||
example:
|
|
||||||
name: "name"
|
|
||||||
id: 1
|
|
||||||
xml:
|
|
||||||
name: "Tag"
|
|
||||||
Pet:
|
|
||||||
type: "object"
|
|
||||||
required:
|
|
||||||
- "name"
|
|
||||||
- "photoUrls"
|
|
||||||
properties:
|
|
||||||
id:
|
|
||||||
type: "integer"
|
|
||||||
format: "int64"
|
|
||||||
category:
|
|
||||||
$ref: "#/definitions/Category"
|
|
||||||
name:
|
|
||||||
type: "string"
|
|
||||||
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"
|
|
||||||
title: "a Pet"
|
|
||||||
description: "A pet for sale in the pet store"
|
|
||||||
example:
|
|
||||||
photoUrls:
|
|
||||||
- "photoUrls"
|
|
||||||
- "photoUrls"
|
|
||||||
name: "doggie"
|
|
||||||
id: 0
|
|
||||||
category:
|
|
||||||
name: "name"
|
|
||||||
id: 6
|
|
||||||
tags:
|
|
||||||
- name: "name"
|
|
||||||
id: 1
|
|
||||||
- name: "name"
|
|
||||||
id: 1
|
|
||||||
status: "available"
|
|
||||||
xml:
|
|
||||||
name: "Pet"
|
|
||||||
ApiResponse:
|
|
||||||
type: "object"
|
|
||||||
properties:
|
|
||||||
code:
|
|
||||||
type: "integer"
|
|
||||||
format: "int32"
|
|
||||||
type:
|
|
||||||
type: "string"
|
|
||||||
message:
|
|
||||||
type: "string"
|
|
||||||
title: "An uploaded response"
|
|
||||||
description: "Describes the result of uploading an image resource"
|
|
||||||
example:
|
|
||||||
code: 0
|
|
||||||
type: "type"
|
|
||||||
message: "message"
|
|
||||||
externalDocs:
|
|
||||||
description: "Find out more about Swagger"
|
|
||||||
url: "http://swagger.io"
|
|
@ -10,7 +10,7 @@ class BaseTestCase(TestCase):
|
|||||||
|
|
||||||
def create_app(self):
|
def create_app(self):
|
||||||
logging.getLogger('connexion.operation').setLevel('ERROR')
|
logging.getLogger('connexion.operation').setLevel('ERROR')
|
||||||
app = connexion.App(__name__, specification_dir='../swagger/')
|
app = connexion.App(__name__, specification_dir='../openapi/')
|
||||||
app.app.json_encoder = JSONEncoder
|
app.app.json_encoder = JSONEncoder
|
||||||
app.add_api('swagger.yaml')
|
app.add_api('openapi.yaml')
|
||||||
return app.app
|
return app.app
|
||||||
|
@ -18,11 +18,11 @@ class TestPetController(BaseTestCase):
|
|||||||
|
|
||||||
Add a new pet to the store
|
Add a new pet to the store
|
||||||
"""
|
"""
|
||||||
body = Pet()
|
pet = Pet()
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/pet',
|
'/v2/pet',
|
||||||
method='POST',
|
method='POST',
|
||||||
data=json.dumps(body),
|
data=json.dumps(pet),
|
||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
@ -34,7 +34,7 @@ class TestPetController(BaseTestCase):
|
|||||||
"""
|
"""
|
||||||
headers = [('api_key', 'api_key_example')]
|
headers = [('api_key', 'api_key_example')]
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/pet/{petId}'.format(petId=789),
|
'/v2/pet/{petId}'.format(pet_id=789),
|
||||||
method='DELETE',
|
method='DELETE',
|
||||||
headers=headers)
|
headers=headers)
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
@ -72,7 +72,7 @@ class TestPetController(BaseTestCase):
|
|||||||
Find pet by ID
|
Find pet by ID
|
||||||
"""
|
"""
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/pet/{petId}'.format(petId=789),
|
'/v2/pet/{petId}'.format(pet_id=789),
|
||||||
method='GET')
|
method='GET')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
@ -82,11 +82,11 @@ class TestPetController(BaseTestCase):
|
|||||||
|
|
||||||
Update an existing pet
|
Update an existing pet
|
||||||
"""
|
"""
|
||||||
body = Pet()
|
pet = Pet()
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/pet',
|
'/v2/pet',
|
||||||
method='PUT',
|
method='PUT',
|
||||||
data=json.dumps(body),
|
data=json.dumps(pet),
|
||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
@ -99,7 +99,7 @@ class TestPetController(BaseTestCase):
|
|||||||
data = dict(name='name_example',
|
data = dict(name='name_example',
|
||||||
status='status_example')
|
status='status_example')
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/pet/{petId}'.format(petId=789),
|
'/v2/pet/{petId}'.format(pet_id=789),
|
||||||
method='POST',
|
method='POST',
|
||||||
data=data,
|
data=data,
|
||||||
content_type='application/x-www-form-urlencoded')
|
content_type='application/x-www-form-urlencoded')
|
||||||
@ -111,10 +111,10 @@ class TestPetController(BaseTestCase):
|
|||||||
|
|
||||||
uploads an image
|
uploads an image
|
||||||
"""
|
"""
|
||||||
data = dict(additionalMetadata='additionalMetadata_example',
|
data = dict(additional_metadata='additional_metadata_example',
|
||||||
file=(BytesIO(b'some file data'), 'file.txt'))
|
file=(BytesIO(b'some file data'), 'file.txt'))
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/pet/{petId}/uploadImage'.format(petId=789),
|
'/v2/pet/{petId}/uploadImage'.format(pet_id=789),
|
||||||
method='POST',
|
method='POST',
|
||||||
data=data,
|
data=data,
|
||||||
content_type='multipart/form-data')
|
content_type='multipart/form-data')
|
||||||
|
@ -18,7 +18,7 @@ class TestStoreController(BaseTestCase):
|
|||||||
Delete purchase order by ID
|
Delete purchase order by ID
|
||||||
"""
|
"""
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/store/order/{orderId}'.format(orderId='orderId_example'),
|
'/v2/store/order/{orderId}'.format(order_id='order_id_example'),
|
||||||
method='DELETE')
|
method='DELETE')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
@ -40,7 +40,7 @@ class TestStoreController(BaseTestCase):
|
|||||||
Find purchase order by ID
|
Find purchase order by ID
|
||||||
"""
|
"""
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/store/order/{orderId}'.format(orderId=5),
|
'/v2/store/order/{orderId}'.format(order_id=5),
|
||||||
method='GET')
|
method='GET')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
@ -50,12 +50,12 @@ class TestStoreController(BaseTestCase):
|
|||||||
|
|
||||||
Place an order for a pet
|
Place an order for a pet
|
||||||
"""
|
"""
|
||||||
body = Order()
|
order = Order()
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/store/order',
|
'/v2/store/order',
|
||||||
method='POST',
|
method='POST',
|
||||||
data=json.dumps(body),
|
data=json.dumps(order),
|
||||||
content_type='application/json')
|
content_type='*/*')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ class TestUserController(BaseTestCase):
|
|||||||
|
|
||||||
Create user
|
Create user
|
||||||
"""
|
"""
|
||||||
body = User()
|
user = User()
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/user',
|
'/v2/user',
|
||||||
method='POST',
|
method='POST',
|
||||||
data=json.dumps(body),
|
data=json.dumps(user),
|
||||||
content_type='application/json')
|
content_type='*/*')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
@ -31,12 +31,12 @@ class TestUserController(BaseTestCase):
|
|||||||
|
|
||||||
Creates list of users with given input array
|
Creates list of users with given input array
|
||||||
"""
|
"""
|
||||||
body = [User()]
|
user = [User()]
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/user/createWithArray',
|
'/v2/user/createWithArray',
|
||||||
method='POST',
|
method='POST',
|
||||||
data=json.dumps(body),
|
data=json.dumps(user),
|
||||||
content_type='application/json')
|
content_type='*/*')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
@ -45,12 +45,12 @@ class TestUserController(BaseTestCase):
|
|||||||
|
|
||||||
Creates list of users with given input array
|
Creates list of users with given input array
|
||||||
"""
|
"""
|
||||||
body = [User()]
|
user = [User()]
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/user/createWithList',
|
'/v2/user/createWithList',
|
||||||
method='POST',
|
method='POST',
|
||||||
data=json.dumps(body),
|
data=json.dumps(user),
|
||||||
content_type='application/json')
|
content_type='*/*')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
@ -106,12 +106,12 @@ class TestUserController(BaseTestCase):
|
|||||||
|
|
||||||
Updated user
|
Updated user
|
||||||
"""
|
"""
|
||||||
body = User()
|
user = User()
|
||||||
response = self.client.open(
|
response = self.client.open(
|
||||||
'/v2/user/{username}'.format(username='username_example'),
|
'/v2/user/{username}'.format(username='username_example'),
|
||||||
method='PUT',
|
method='PUT',
|
||||||
data=json.dumps(body),
|
data=json.dumps(user),
|
||||||
content_type='application/json')
|
content_type='*/*')
|
||||||
self.assert200(response,
|
self.assert200(response,
|
||||||
'Response body is : ' + response.data.decode('utf-8'))
|
'Response body is : ' + response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user