{
  "openapi": "3.2.0",
  "info": {
    "title": "Buggy API",
    "description": "A deliberately buggy shopping cart API for API testing practice.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://apichallenges.eviltester.com",
      "description": "cloud hosted version"
    },
    {
      "url": "http://localhost:4567",
      "description": "local execution"
    }
  ],
  "paths": {
    "/shop/products": {
      "get": {
        "summary": "return all the instances of product",
        "description": "return all the instances of product",
        "responses": {
          "200": {
            "description": "All the products",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/products"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/products"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "show all Options for endpoint of /shop/products",
        "description": "show all Options for endpoint of /shop/products",
        "responses": {
          "204": {
            "description": "the endpoint verb options"
          }
        }
      },
      "head": {
        "summary": "headers for all the instances of product",
        "description": "headers for all the instances of product",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "query": {
        "summary": "query all the instances of product using application/x-www-form-urlencoded query content",
        "description": "query all the instances of product using application/x-www-form-urlencoded query content",
        "responses": {
          "200": {
            "description": "All the matching products",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/products"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/products"
                }
              }
            }
          },
          "400": {
            "description": "Error processing request"
          },
          "413": {
            "description": "Standard Status Code Meaning"
          },
          "415": {
            "description": "Standard Status Code Meaning"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/shop/products/{id}": {
      "get": {
        "summary": "return a specific instances of product using a id",
        "description": "return a specific instances of product using a id",
        "responses": {
          "200": {
            "description": "A specific product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/product"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/product"
                }
              }
            }
          },
          "404": {
            "description": "Could not find a specific product"
          }
        }
      },
      "options": {
        "summary": "show all Options for endpoint of /shop/products/:id",
        "description": "show all Options for endpoint of /shop/products/:id",
        "responses": {
          "204": {
            "description": "OK, No Content"
          }
        }
      },
      "head": {
        "summary": "headers for a specific instances of product using a id",
        "description": "headers for a specific instances of product using a id",
        "responses": {
          "200": {
            "description": "Headers for a specific product"
          },
          "404": {
            "description": "Could not find a specific product"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "description": "Unique product identifier.",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "example": "92"
        }
      ]
    },
    "/shop/carts": {
      "get": {
        "summary": "return all the instances of cart",
        "description": "return all the instances of cart",
        "responses": {
          "200": {
            "description": "All the carts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/carts"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/carts"
                }
              }
            }
          }
        }
      },
      "options": {
        "summary": "show all Options for endpoint of /shop/carts",
        "description": "show all Options for endpoint of /shop/carts",
        "responses": {
          "204": {
            "description": "the endpoint verb options"
          }
        }
      },
      "head": {
        "summary": "headers for all the instances of cart",
        "description": "headers for all the instances of cart",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "query": {
        "summary": "query all the instances of cart using application/x-www-form-urlencoded query content",
        "description": "query all the instances of cart using application/x-www-form-urlencoded query content",
        "responses": {
          "200": {
            "description": "All the matching carts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/carts"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/carts"
                }
              }
            }
          },
          "400": {
            "description": "Error processing request"
          },
          "413": {
            "description": "Standard Status Code Meaning"
          },
          "415": {
            "description": "Standard Status Code Meaning"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/shop/carts/{id}": {
      "get": {
        "summary": "return a specific instances of cart using a id",
        "description": "return a specific instances of cart using a id",
        "responses": {
          "200": {
            "description": "A specific cart",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/cart"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/cart"
                }
              }
            }
          },
          "404": {
            "description": "Could not find a specific cart"
          }
        }
      },
      "delete": {
        "summary": "delete or abandon a cart using the cart bearer token",
        "description": "delete or abandon a cart using the cart bearer token",
        "responses": {
          "204": {
            "description": "Deleted a specific cart"
          },
          "404": {
            "description": "Could not find a specific cart"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "options": {
        "summary": "show all Options for endpoint of /shop/carts/:id",
        "description": "show all Options for endpoint of /shop/carts/:id",
        "responses": {
          "204": {
            "description": "OK, No Content"
          }
        }
      },
      "head": {
        "summary": "headers for a specific instances of cart using a id",
        "description": "headers for a specific instances of cart using a id",
        "responses": {
          "200": {
            "description": "Headers for a specific cart"
          },
          "404": {
            "description": "Could not find a specific cart"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "description": "Unique cart identifier.",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "example": "80"
        }
      ]
    },
    "/shop/carts/{id}/items": {
      "get": {
        "summary": "return all the cartitem items related to cart, with given id, by the relationship named items",
        "description": "return all the cartitem items related to cart, with given id, by the relationship named items",
        "responses": {
          "200": {
            "description": "all the related cartitem items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/cartitems"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/cartitems"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "add a product line to a cart using the cart bearer token",
        "description": "add a product line to a cart using the cart bearer token",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/create_AddedCartItem"
              }
            },
            "application/xml": {
              "schema": {
                "$ref": "#/components/schemas/create_AddedCartItem"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "created the relationship",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddedCartItem"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/AddedCartItem"
                }
              }
            }
          },
          "400": {
            "description": "error when creating the relationship"
          },
          "404": {
            "description": "relationship source or target not found"
          },
          "422": {
            "description": "validation error when creating the relationship"
          },
          "409": {
            "description": "conflict when creating the relationship"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "options": {
        "summary": "show all Options for endpoint of /shop/carts/:id/items",
        "description": "show all Options for endpoint of /shop/carts/:id/items",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "head": {
        "summary": "headers for the cartitem items related to cart, with given id, by the relationship named items",
        "description": "headers for the cartitem items related to cart, with given id, by the relationship named items",
        "responses": {
          "200": {
            "description": "headers for all the related cartitem items"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "description": "Unique cart identifier.",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "example": "82"
        }
      ],
      "query": {
        "summary": "query all the cartitem items related to cart, with given id, by the relationship named items using application/x-www-form-urlencoded query content",
        "description": "query all the cartitem items related to cart, with given id, by the relationship named items using application/x-www-form-urlencoded query content",
        "responses": {
          "200": {
            "description": "all the matching related cartitem items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/cartitems"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/cartitems"
                }
              }
            }
          },
          "400": {
            "description": "Error processing request"
          },
          "413": {
            "description": "Standard Status Code Meaning"
          },
          "415": {
            "description": "Standard Status Code Meaning"
          }
        },
        "requestBody": {
          "required": false,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/shop/carts/{id}/items/{relatedId}": {
      "delete": {
        "summary": "delete a product line from a cart using the cart bearer token",
        "description": "delete a product line from a cart using the cart bearer token",
        "responses": {
          "204": {
            "description": "deleted the relationship"
          },
          "400": {
            "description": "error when deleting the relationship"
          },
          "404": {
            "description": "relationship not found"
          },
          "422": {
            "description": "validation error when deleting the relationship"
          },
          "409": {
            "description": "conflict when deleting the relationship"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "options": {
        "summary": "show all Options for endpoint of /shop/carts/:id/items/:relatedId",
        "description": "show all Options for endpoint of /shop/carts/:id/items/:relatedId",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "description": "Unique cart identifier.",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "example": "48"
        },
        {
          "name": "relatedId",
          "in": "path",
          "description": "Unique cart item identifier.",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "example": "34"
        }
      ]
    },
    "/shop/register": {
      "post": {
        "summary": "create a new open cart and return its bearer token",
        "description": "create a new open cart and return its bearer token",
        "responses": {
          "201": {
            "description": "OK, Created"
          }
        }
      }
    },
    "/shop/checkout/{cartId}": {
      "post": {
        "summary": "checkout a cart using its bearer token in the Authorization header",
        "description": "checkout a cart using its bearer token in the Authorization header",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Standard Status Code Meaning"
          },
          "403": {
            "description": "Standard Status Code Meaning"
          },
          "404": {
            "description": "Not Found"
          },
          "409": {
            "description": "Standard Status Code Meaning"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "parameters": [
        {
          "name": "cartId",
          "in": "path",
          "description": "Cart identifier returned by POST /shop/register.",
          "required": true,
          "schema": {
            "type": "integer"
          },
          "example": "1"
        }
      ]
    }
  },
  "components": {
    "schemas": {
      "product": {
        "type": "object",
        "description": "A safe fixed catalogue item with internally maintained stock.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique product identifier. Field is an ID and should not be amended or set.",
            "example": "7"
          },
          "productCode": {
            "type": "string",
            "description": "Safe catalogue code for the product. Value must be an Enum (BOOK_REST, CD_HEADERS, MUG_TESTER, USB_CABLE, PEN_RED, POSTER_API, BLURAY_HTTP, DVD_BUGS, PUZZLE_CACHE, STICKER_HTTP, PUZZLE_PROXY, NOTEBOOK_LOGS, STICKER_PACK, POSTER_BUG, BOOK_API, BOOK_TESTS, MUG_CLIENT, NOTEBOOK_GRID, GAME_JSON, USB_HUB, CD_STATUS, GAME_TOKENS, PEN_BLUE, DVD_STATUS) value. Value is mandatory.",
            "example": "BOOK_REST"
          },
          "category": {
            "type": "string",
            "description": "Safe category for the product. Value must be an Enum (cd, game, electronics, art, dvd, book, homeware, stationery, blu-ray) value. Value is mandatory.",
            "example": "cd"
          },
          "unitPrice": {
            "type": "number",
            "description": "Current unit price used for new cart lines. Value must be a Float of min 0.010000 and max 500.000000. Value is mandatory.",
            "example": "1.00"
          },
          "stock": {
            "type": "integer",
            "description": "Current available stock count maintained by the API. Value must be an Integer of min -1000 and max 9999. Value is mandatory.",
            "example": "0"
          }
        },
        "title": "product",
        "xml": {
          "name": "product",
          "wrapped": true
        }
      },
      "create_product": {
        "type": "object",
        "description": "A safe fixed catalogue item with internally maintained stock.",
        "properties": {
          "productCode": {
            "type": "string",
            "description": "Safe catalogue code for the product. Value must be an Enum (BOOK_REST, CD_HEADERS, MUG_TESTER, USB_CABLE, PEN_RED, POSTER_API, BLURAY_HTTP, DVD_BUGS, PUZZLE_CACHE, STICKER_HTTP, PUZZLE_PROXY, NOTEBOOK_LOGS, STICKER_PACK, POSTER_BUG, BOOK_API, BOOK_TESTS, MUG_CLIENT, NOTEBOOK_GRID, GAME_JSON, USB_HUB, CD_STATUS, GAME_TOKENS, PEN_BLUE, DVD_STATUS) value. Value is mandatory.",
            "example": "BOOK_REST"
          },
          "category": {
            "type": "string",
            "description": "Safe category for the product. Value must be an Enum (cd, game, electronics, art, dvd, book, homeware, stationery, blu-ray) value. Value is mandatory.",
            "example": "cd"
          },
          "unitPrice": {
            "type": "number",
            "description": "Current unit price used for new cart lines. Value must be a Float of min 0.010000 and max 500.000000. Value is mandatory.",
            "example": "1.00"
          },
          "stock": {
            "type": "integer",
            "description": "Current available stock count maintained by the API. Value must be an Integer of min -1000 and max 9999. Value is mandatory.",
            "example": "0"
          }
        },
        "title": "create product",
        "xml": {
          "name": "product",
          "wrapped": true
        }
      },
      "products": {
        "type": "array",
        "description": "products",
        "items": {
          "$ref": "#/components/schemas/product"
        },
        "title": "products",
        "xml": {
          "wrapped": true
        }
      },
      "cart": {
        "type": "object",
        "description": "A user's shopping cart, created through registration.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique cart identifier. Field is an ID and should not be amended or set.",
            "example": "99"
          },
          "token": {
            "type": "string",
            "description": "Protected bearer token for cart mutation. Field is an ID and should not be amended or set. Value is mandatory.",
            "example": "4820fe77-8fc3-4796-838f-0263572cd514"
          },
          "state": {
            "type": "string",
            "description": "Lifecycle state of the cart. Value must be an Enum (closed, abandoned, open) value. Value is mandatory.",
            "example": "closed"
          },
          "createdTick": {
            "type": "integer",
            "description": "Internal tick when the cart was created. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "updatedTick": {
            "type": "integer",
            "description": "Internal tick when the cart was last changed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "checkoutTick": {
            "type": "integer",
            "description": "Internal tick when checkout last completed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          }
        },
        "title": "cart",
        "xml": {
          "name": "cart",
          "wrapped": true
        }
      },
      "create_cart": {
        "type": "object",
        "description": "A user's shopping cart, created through registration.",
        "properties": {
          "state": {
            "type": "string",
            "description": "Lifecycle state of the cart. Value must be an Enum (closed, abandoned, open) value. Value is mandatory.",
            "example": "closed"
          },
          "createdTick": {
            "type": "integer",
            "description": "Internal tick when the cart was created. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "updatedTick": {
            "type": "integer",
            "description": "Internal tick when the cart was last changed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "checkoutTick": {
            "type": "integer",
            "description": "Internal tick when checkout last completed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          }
        },
        "title": "create cart",
        "xml": {
          "name": "cart",
          "wrapped": true
        }
      },
      "carts": {
        "type": "array",
        "description": "carts",
        "items": {
          "$ref": "#/components/schemas/cart"
        },
        "title": "carts",
        "xml": {
          "wrapped": true
        }
      },
      "PublicCart": {
        "type": "object",
        "description": "A user's shopping cart, created through registration.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique cart identifier. Field is an ID and should not be amended or set.",
            "example": "25"
          },
          "state": {
            "type": "string",
            "description": "Lifecycle state of the cart. Value must be an Enum (closed, abandoned, open) value. Value is mandatory.",
            "example": "closed"
          },
          "createdTick": {
            "type": "integer",
            "description": "Internal tick when the cart was created. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "updatedTick": {
            "type": "integer",
            "description": "Internal tick when the cart was last changed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "checkoutTick": {
            "type": "integer",
            "description": "Internal tick when checkout last completed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          }
        },
        "title": "PublicCart",
        "xml": {
          "name": "cart",
          "wrapped": true
        }
      },
      "create_PublicCart": {
        "type": "object",
        "description": "A user's shopping cart, created through registration.",
        "properties": {
          "state": {
            "type": "string",
            "description": "Lifecycle state of the cart. Value must be an Enum (closed, abandoned, open) value. Value is mandatory.",
            "example": "closed"
          },
          "createdTick": {
            "type": "integer",
            "description": "Internal tick when the cart was created. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "updatedTick": {
            "type": "integer",
            "description": "Internal tick when the cart was last changed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          },
          "checkoutTick": {
            "type": "integer",
            "description": "Internal tick when checkout last completed. Value must be an Integer of min 0 and max 999999.",
            "example": "0"
          }
        },
        "title": "create PublicCart",
        "xml": {
          "name": "cart",
          "wrapped": true
        }
      },
      "cartitem": {
        "type": "object",
        "description": "A product line in a shopping cart.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique cart item identifier. Field is an ID and should not be amended or set.",
            "example": "14"
          },
          "productId": {
            "type": "integer",
            "description": "Product identifier requested for this cart line. Value must be an Integer of min 1 and max 24. Value is mandatory.",
            "example": "1"
          },
          "quantity": {
            "type": "integer",
            "description": "Requested quantity for this cart line. Value must be an Integer of min -1000 and max 9999. Value is mandatory.",
            "example": "1"
          },
          "unitPriceAtAdd": {
            "type": "number",
            "description": "Product unit price captured when the line was added. Value must be a Float of min 0.000000 and max 500.000000.",
            "example": "0.00"
          },
          "stockAtAdd": {
            "type": "integer",
            "description": "Product stock captured when the line was added. Value must be an Integer of min -1000 and max 9999.",
            "example": "0"
          }
        },
        "title": "cartitem",
        "xml": {
          "name": "cartitem",
          "wrapped": true
        }
      },
      "create_cartitem": {
        "type": "object",
        "description": "A product line in a shopping cart.",
        "properties": {
          "productId": {
            "type": "integer",
            "description": "Product identifier requested for this cart line. Value must be an Integer of min 1 and max 24. Value is mandatory.",
            "example": "1"
          },
          "quantity": {
            "type": "integer",
            "description": "Requested quantity for this cart line. Value must be an Integer of min -1000 and max 9999. Value is mandatory.",
            "example": "1"
          },
          "unitPriceAtAdd": {
            "type": "number",
            "description": "Product unit price captured when the line was added. Value must be a Float of min 0.000000 and max 500.000000.",
            "example": "0.00"
          },
          "stockAtAdd": {
            "type": "integer",
            "description": "Product stock captured when the line was added. Value must be an Integer of min -1000 and max 9999.",
            "example": "0"
          }
        },
        "title": "create cartitem",
        "xml": {
          "name": "cartitem",
          "wrapped": true
        }
      },
      "cartitems": {
        "type": "array",
        "description": "cartitems",
        "items": {
          "$ref": "#/components/schemas/cartitem"
        },
        "title": "cartitems",
        "xml": {
          "wrapped": true
        }
      },
      "AddedCartItem": {
        "type": "object",
        "description": "A product line in a shopping cart.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique cart item identifier. Field is an ID and should not be amended or set.",
            "example": "4"
          },
          "productId": {
            "type": "integer",
            "description": "Product identifier requested for this cart line. Value must be an Integer of min 1 and max 24. Value is mandatory.",
            "example": "1"
          },
          "quantity": {
            "type": "integer",
            "description": "Requested quantity for this cart line. Value must be an Integer of min -1000 and max 9999. Value is mandatory.",
            "example": "1"
          },
          "unitPriceAtAdd": {
            "type": "number",
            "description": "Product unit price captured when the line was added. Value must be a Float of min 0.000000 and max 500.000000.",
            "example": "0.00"
          },
          "stockAtAdd": {
            "type": "integer",
            "description": "Product stock captured when the line was added. Value must be an Integer of min -1000 and max 9999.",
            "example": "0"
          }
        },
        "title": "AddedCartItem",
        "xml": {
          "name": "cartitem",
          "wrapped": true
        }
      },
      "create_AddedCartItem": {
        "type": "object",
        "description": "A product line in a shopping cart.",
        "properties": {
          "productId": {
            "type": "integer",
            "description": "Product identifier requested for this cart line. Value must be an Integer of min 1 and max 24. Value is mandatory.",
            "example": "1"
          },
          "quantity": {
            "type": "integer",
            "description": "Requested quantity for this cart line. Value must be an Integer of min -1000 and max 9999. Value is mandatory.",
            "example": "1"
          }
        },
        "title": "create AddedCartItem",
        "xml": {
          "name": "cartitem",
          "wrapped": true
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}