Skip to content

Instantly share code, notes, and snippets.

@sixthextinction
Created August 13, 2023 17:55
Show Gist options
  • Save sixthextinction/cd3a96c8b79b59d6a260230e2d0ab80e to your computer and use it in GitHub Desktop.
Save sixthextinction/cd3a96c8b79b59d6a260230e2d0ab80e to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.0",
"info": {
"title": "Product Catalog Service",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:3001"
}
],
"paths": {
"/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"
}
}
}
}
},
"components": {
"schemas": {
"Product": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"price": {
"type": "number",
"format": "float"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment