73 lines
1.5 KiB
Python
73 lines
1.5 KiB
Python
|
get_products_swagger = {
|
||
|
"methods": ["GET"],
|
||
|
"tags": ["Products"],
|
||
|
"parameters": [
|
||
|
|
||
|
],
|
||
|
"responses":
|
||
|
{
|
||
|
"200":
|
||
|
{
|
||
|
"description": "Get a page of products",
|
||
|
"schema":
|
||
|
{
|
||
|
"type": "object",
|
||
|
"properties": {
|
||
|
"message": {"type": "string", "example": "Hello, Flask!"}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
get_product_info_swagger = {
|
||
|
"tags": ["Products"],
|
||
|
"parameters": [
|
||
|
{
|
||
|
"name": "id",
|
||
|
"in": "path",
|
||
|
"type": "integer",
|
||
|
"description": "ID of the product to fetch information for",
|
||
|
"required": True
|
||
|
},
|
||
|
{
|
||
|
"name": "fields",
|
||
|
"in": "query",
|
||
|
"type": "string",
|
||
|
"description": "Comma-separated list of fields to include in the response",
|
||
|
"required": False
|
||
|
}
|
||
|
],
|
||
|
"responses": {
|
||
|
"200": {"description": "Successfully fetched product information"},
|
||
|
"400": {"description": "Bad Request - Invalid input or product doesn't exist"},
|
||
|
"500": {"description": "Internal Server Error"}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
create_product_swagger = {
|
||
|
"methods": ["POST"],
|
||
|
"tags": ["Products"],
|
||
|
"security": [{"JWT": []}],
|
||
|
"parameters": [
|
||
|
{
|
||
|
"name": "name",
|
||
|
"in": "body",
|
||
|
"type": "string",
|
||
|
"description": "Name for the new product",
|
||
|
"required": True
|
||
|
},
|
||
|
{
|
||
|
"name": "price",
|
||
|
"in": "body",
|
||
|
"type": "float",
|
||
|
"description": "Price of the product",
|
||
|
"required": True
|
||
|
}
|
||
|
],
|
||
|
"responses": {
|
||
|
"200": {"description": "Successfully fetched product information"},
|
||
|
"400": {"description": "Bad Request - Invalid input or missing input"},
|
||
|
"500": {"description": "Internal Server Error"}
|
||
|
}
|
||
|
}
|