swag-shop/app/doc/cart_swag.py

77 lines
1.2 KiB
Python

show_cart_swagger = {
"tags": ["Cart"],
"security":
[
{"JWT": []}
],
"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"],
"security":
[
{"JWT": []}
],
"parameters":
[
{
"name": "product_id",
"description": "ID of product to add to cart.",
"in": "path",
"type": "int",
},
{
"name": "count",
"description": "Count of the products. If not provided, defaults to 1",
"in": "query",
"type": "int",
"default": 1,
"minimum": 1,
"required": False
}
],
"responses":
{
"200":
{
"description": "Successfully added a product to cart"
},
"400":
{
"description": "Causes:\n- Count is < 1"
}
}
}