openapi: 3.0.2 info: title: API Title version: "1.0" servers: - url: http://localhost:8000 description: URL for local development and testing paths: /orders: get: parameters: - name: cancelled in: query required: false schema: type: boolean - name: limit in: query required: false schema: type: integer responses: "200": description: A JSON array of orders content: application/json: schema: type: object properties: orders: type: array items: $ref: "#/components/schemas/GetOrderSchema" examples: example1: value: |- { "orders": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "created": "2024-03-05T12:53:29.935Z", "status": "created", "order": [ { "product": "string", "size": "small", "quantity": 1 } ] } ] } post: summary: Creates an order operationId: createOrder requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOrderSchema" responses: "201": description: A JSON representation of the created order content: application/json: schema: $ref: "#/components/schemas/GetOrderSchema" /orders/{order_id}: parameters: - in: path name: order_id required: true schema: type: string format: uuid get: summary: Returns the details of a specific order operationId: getOrder responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GetOrderSchema" "404": $ref: "#/components/responses/NotFound" put: summary: Replaces an existing order operationId: updateOrder requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOrderSchema" responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GetOrderSchema" delete: summary: Deletes an existing order operationId: deleteOrder responses: "204": description: The resource was deleted successfully /orders/{order_id}/pay: parameters: - in: path name: order_id required: true schema: type: string format: uuid post: summary: Processes payment for an order operationId: payOrder responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GetOrderSchema" /orders/{order_id}/cancel: parameters: - in: path name: order_id required: true schema: type: string format: uuid post: summary: Cancels an order operationId: cancelOrder responses: "200": description: OK content: application/json: schema: $ref: "#/components/schemas/GetOrderSchema" components: responses: NotFound: description: The specified resource was not found content: application/json: schema: $ref: "#/components/schemas/Error" schemas: OrderItemSchema: type: object required: - product - size properties: product: type: string size: type: string enum: - small - medium - large quantity: type: integer default: 1 minimum: 1 CreateOrderSchema: type: object required: - order properties: order: type: array minItems: 1 items: $ref: "#/components/schemas/OrderItemSchema" GetOrderSchema: additionalProperties: false allOf: - $ref: "#/components/schemas/CreateOrderSchema" - type: object properties: status: type: string enum: - created - paid - progress - cancelled - dispatched - delivered created: type: string format: date-time Error: type: object properties: detail: type: string required: - detail securitySchemes: openId: type: openIdConnect openIdConnectUrl: https://coffeemesh-dev.eu.auth0.com/.well-known/openid-configuration oauth2: type: oauth2 flows: clientCredentials: tokenUrl: https://coffeemesh.dev.eu.auth0.com/oauth/token scopes: {} bearerAuth: type: http scheme: bearer bearerFormat: JWT security: - oauth2: - getOrders - createOrder - getOrder - updateOrder - deleteOrder - payOrder - cancelOrder - bearerAuth: - getOrders - createOrder - getOrder - updateOrder - deleteOrder - payOrder - cancelOrder