Started work on swagger
This commit is contained in:
1 parent
248bf45044
commit
dfccda02b8
8 files changed
+143
No files matched your search
@@ -0,0 +1,80 @@
|
||||
show_cart_swagger = {
|
||||
"tags": ["Cart"],
|
||||
"parameters":
|
||||
[
|
||||
{
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"type": "string",
|
||||
"required": True
|
||||
}
|
||||
],
|
||||
"responses":
|
||||
{
|
||||
"200":
|
||||
{
|
||||
"description": "Current content of user's shopping cart",
|
||||
"schema":
|
||||
{
|
||||
"items":
|
||||
{
|
||||
"count": {"type": "int"},
|
||||
"date_added": {"type": "string"},
|
||||
"name": {"type": "string"},
|
||||
"price_subtotal": {"type": "string"}
|
||||
},
|
||||
"example":
|
||||
[
|
||||
{
|
||||
"count": 5,
|
||||
"date_added": "Fri, 08 Mar 2024 08:43:09 GMT",
|
||||
"name": "Tablet",
|
||||
"price_subtotal": "1499.95"
|
||||
},
|
||||
{
|
||||
"count": 2,
|
||||
"date_added": "Fri, 08 Mar 2024 06:43:09 GMT",
|
||||
"name": "Laptop",
|
||||
"price_subtotal": "999.95"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_to_cart_swagger ={
|
||||
"tags": ["Cart"],
|
||||
"parameters":
|
||||
[
|
||||
{
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"type": "string",
|
||||
"required": True
|
||||
},
|
||||
{
|
||||
"name": "product_id",
|
||||
"in": "path",
|
||||
"type": "int",
|
||||
"required": True
|
||||
},
|
||||
{
|
||||
"name": "count",
|
||||
"in": "query",
|
||||
"type": "int",
|
||||
"required": False
|
||||
}
|
||||
],
|
||||
"responses":
|
||||
{
|
||||
"200":
|
||||
{
|
||||
"description": "Successfully added a product to cart"
|
||||
},
|
||||
"400":
|
||||
{
|
||||
"description": "Incorrect usage. For example id of product not found or product count < 1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
main_swagger = {
|
||||
"methods": ["GET"],
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"responses":
|
||||
{
|
||||
"200":
|
||||
{
|
||||
"description": "A hello world json",
|
||||
"schema":
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {"type": "string", "example": "Hello, Flask!"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
get_products_swagger = {
|
||||
"paths": {
|
||||
"/get": {
|
||||
"get": {
|
||||
"summary": "Get products",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successfully retrieved products",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"products": {"type": "array", "items": {"type": "object", "properties": {"id": {"type": "int"}, "name": {"type": "string"}, "price": {"type": "float"}}}}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad request"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Whitespace-only changes.
Reference in new issue
Block a user