-
-
Save sixthextinction/88ba489ce25c33d7dff36d6da28d9eae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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