Skip to content

Instantly share code, notes, and snippets.

@sixthextinction
Created August 13, 2023 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sixthextinction/88ba489ce25c33d7dff36d6da28d9eae to your computer and use it in GitHub Desktop.
Save sixthextinction/88ba489ce25c33d7dff36d6da28d9eae to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.0",
"info": {
"title": "Order Tracking Service",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:3002"
}
],
"paths": {
"/orders": {
"get": {
"summary": "Get all orders with details",
"responses": {
"200": {
"description": "List of orders with details",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OrderWithDetails"
}
}
}
}
}
}
}
},
"/orders/{id}": {
"get": {
"summary": "Get order details by ID",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "Order details",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OrderWithDetails"
}
}
}
},
"404": {
"description": "Order not found"
}
}
}
}
},
"components": {
"schemas": {
"Order": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"customer_id": {
"type": "integer",
"format": "int64"
},
"products": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Product"
}
},
"status": {
"type": "string"
},
"customer": {
"$ref": "#/components/schemas/Customer"
},
"total": {
"type": "number",
"format": "float"
}
}
},
"Product": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"price": {
"type": "number",
"format": "float"
}
}
},
"Customer": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"address": {
"type": "string"
}
}
},
"OrderWithDetails": {
"allOf": [
{
"$ref": "#/components/schemas/Order"
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment