-
-
Save sixthextinction/47d12df6239d427e3183344a8bb3b5b3 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": "Mock API", | |
"description": "A public API for customers, products, and orders.", | |
"version": "1.0.0" | |
}, | |
"servers": [ | |
{ | |
"url": "http://localhost:3001", | |
"description": "Local development server" | |
} | |
], | |
"paths": { | |
"/customers": { | |
"get": { | |
"summary": "Get a list of customers", | |
"responses": { | |
"200": { | |
"description": "Successful response", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Customer" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/customers/{id}": { | |
"get": { | |
"summary": "Get customer by ID", | |
"parameters": [ | |
{ | |
"name": "id", | |
"in": "path", | |
"required": true, | |
"schema": { | |
"type": "integer", | |
"format": "int64" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Customer details", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Customer" | |
} | |
} | |
} | |
}, | |
"404": { | |
"description": "Customer not found" | |
} | |
} | |
} | |
}, | |
"/products": { | |
"get": { | |
"summary": "Get all products", | |
"responses": { | |
"200": { | |
"description": "List of products", | |
"content": { | |
"application/json": { | |
"schema": { | |
"type": "array", | |
"items": { | |
"$ref": "#/components/schemas/Product" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/products/{id}": { | |
"get": { | |
"summary": "Get product by ID", | |
"parameters": [ | |
{ | |
"name": "id", | |
"in": "path", | |
"required": true, | |
"schema": { | |
"type": "integer", | |
"format": "int64" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Product details", | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/components/schemas/Product" | |
} | |
} | |
} | |
}, | |
"404": { | |
"description": "Product not found" | |
} | |
} | |
} | |
}, | |
"/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/Order" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"/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/Order" | |
} | |
} | |
} | |
}, | |
"404": { | |
"description": "Order not found" | |
} | |
} | |
} | |
} | |
}, | |
"components": { | |
"schemas": { | |
"Customer": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "integer" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"email": { | |
"type": "string" | |
}, | |
"address": { | |
"type": "string" | |
} | |
} | |
}, | |
"Product": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "integer" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"price": { | |
"type": "number", | |
"format": "float" | |
} | |
} | |
}, | |
"Order": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "integer" | |
}, | |
"customer_id": { | |
"type": "integer" | |
}, | |
"products": { | |
"type": "array", | |
"items": { | |
"type": "integer" | |
} | |
}, | |
"total": { | |
"type": "number", | |
"format": "float" | |
}, | |
"status": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment