add specification part 1 solution
parent
df6f0461b3
commit
fb8993f06c
|
|
@ -0,0 +1,221 @@
|
||||||
|
openapi: 3.1.0
|
||||||
|
info:
|
||||||
|
title: Food Express API
|
||||||
|
description: >
|
||||||
|
API for managing the FoodExpress restaurants, orders, and customers.
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
|
servers:
|
||||||
|
- url: http://localhost:4004/api/v1
|
||||||
|
description: Local development servers
|
||||||
|
- url: https://{stage}.foodexpress.com/api/v1
|
||||||
|
description: Stage server
|
||||||
|
variables:
|
||||||
|
stage:
|
||||||
|
description: Stage
|
||||||
|
enum:
|
||||||
|
- dev
|
||||||
|
- test
|
||||||
|
default: dev
|
||||||
|
- url: https://foodexpress.com/api/v1
|
||||||
|
description: Production server
|
||||||
|
|
||||||
|
paths:
|
||||||
|
/restaurants:
|
||||||
|
get:
|
||||||
|
summary: List restaurants
|
||||||
|
description: Retrieve a list of restaurants.
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: A list of restaurants
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["465db18f-6fc0-48e1-804a-156d0df29392"]
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
examples: ["Thai Food"]
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
examples: ["Hauptstraße 9, 68259 Mannheim"]
|
||||||
|
|
||||||
|
/restaurants/{id}/menu:
|
||||||
|
get:
|
||||||
|
summary: Get restaurant menu
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "09ede9cb-0031-4469-9144-dec6b564f1c0"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Menu for the restaurant
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["9f062baf-236b-44fe-8d30-88cecb02c26b"]
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
examples: ["Cheeseburger"]
|
||||||
|
price:
|
||||||
|
type: number
|
||||||
|
examples: [3.99]
|
||||||
|
"404":
|
||||||
|
description: Restaurant not found
|
||||||
|
|
||||||
|
/restaurants/{id}/orders:
|
||||||
|
get:
|
||||||
|
summary: List orders for a restaurant
|
||||||
|
description: Retrieve a list of orders for a specific restaurant.
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "09ede9cb-0031-4469-9144-dec6b564f1c0"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: A list of orders
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["28c0bc0d-9d17-4b74-9885-84a4cd7c761e"]
|
||||||
|
restaurantId:
|
||||||
|
type: string
|
||||||
|
examples: ["73591883-8aa4-4a2d-a411-abf42220a824"]
|
||||||
|
customerId:
|
||||||
|
type: string
|
||||||
|
examples: ["706f645d-a420-4984-a913-c9a6e0c677f2"]
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- CREATED
|
||||||
|
- CONFIRMED
|
||||||
|
- PREPARING
|
||||||
|
- READY
|
||||||
|
- DELIVERED
|
||||||
|
- CANCELLED
|
||||||
|
examples: ["CREATED"]
|
||||||
|
items:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["9f062baf-236b-44fe-8d30-88cecb02c26b"]
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
examples: ["Cheeseburger"]
|
||||||
|
price:
|
||||||
|
type: number
|
||||||
|
examples: [3.99]
|
||||||
|
totalAmount:
|
||||||
|
type: number
|
||||||
|
examples: [29.95]
|
||||||
|
|
||||||
|
/orders/{orderId}:
|
||||||
|
get:
|
||||||
|
summary: Get order by ID
|
||||||
|
parameters:
|
||||||
|
- name: orderId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "e17aca0c-c956-4a0d-afec-b117a9926e2c"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Order details
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["28c0bc0d-9d17-4b74-9885-84a4cd7c761e"]
|
||||||
|
restaurantId:
|
||||||
|
type: string
|
||||||
|
examples: ["73591883-8aa4-4a2d-a411-abf42220a824"]
|
||||||
|
customerId:
|
||||||
|
type: string
|
||||||
|
examples: ["706f645d-a420-4984-a913-c9a6e0c677f2"]
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- CREATED
|
||||||
|
- CONFIRMED
|
||||||
|
- PREPARING
|
||||||
|
- READY
|
||||||
|
- DELIVERED
|
||||||
|
- CANCELLED
|
||||||
|
examples: ["CREATED"]
|
||||||
|
items:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["9f062baf-236b-44fe-8d30-88cecb02c26b"]
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
examples: ["Cheeseburger"]
|
||||||
|
price:
|
||||||
|
type: number
|
||||||
|
examples: [3.99]
|
||||||
|
totalAmount:
|
||||||
|
type: number
|
||||||
|
examples: [29.95]
|
||||||
|
"404":
|
||||||
|
description: Order not found
|
||||||
|
|
||||||
|
/customers/{id}:
|
||||||
|
get:
|
||||||
|
summary: Get customer by ID
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "18e1d8a2-e7ca-458f-a997-2cc80754105f"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Customer details
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
examples: ["1a7830a6-8e0f-43b2-a0e0-4479cb0acf7d"]
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
examples: ["Max Mustermann"]
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
examples: ["max.mustermann@gmail.com"]
|
||||||
|
"404":
|
||||||
|
description: Customer not found
|
||||||
Loading…
Reference in New Issue