Skip to content

Instantly share code, notes, and snippets.

@joshtwist
Created July 19, 2025 23:01
Show Gist options
  • Save joshtwist/3ed8dcd078a4c7d9f5ed74ee26a78fc3 to your computer and use it in GitHub Desktop.
Save joshtwist/3ed8dcd078a4c7d9f5ed74ee26a78fc3 to your computer and use it in GitHub Desktop.
{
"openapi": "3.1.0",
"info": {
"version": "1.0.0",
"title": "My Zuplo API"
},
"paths": {
"/todos": {
"get": {
"summary": "Get all todos",
"description": "**Retrieves a complete list of all todo items** from the system. This endpoint returns all todos regardless of their completion status or owner, making it useful for displaying comprehensive todo lists or performing bulk operations.",
"responses": {
"200": {
"description": "A list of todos",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Todo"
}
},
"examples": {
"mixed_todos": {
"summary": "A list of todos with different completion states",
"value": [
{
"id": 1,
"title": "Buy groceries",
"completed": false,
"userId": 123
},
{
"id": 2,
"title": "Write documentation",
"completed": true,
"userId": 456
},
{
"id": 3,
"title": "Review pull requests",
"completed": false,
"userId": 123
}
]
}
}
}
}
}
},
"operationId": "get-all-todos",
"x-zuplo-route": {
"corsPolicy": "none",
"handler": {
"export": "urlForwardHandler",
"module": "$import(@zuplo/runtime)",
"options": {
"baseUrl": "https://todo.zuplo.io"
}
}
},
"tags": ["Todo"]
},
"post": {
"summary": "Create a new todo",
"description": "**Creates a new todo item** with the provided details. The todo will be assigned a unique ID automatically and can include a title, completion status, and user association. This is the primary endpoint for adding new tasks to the system.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTodo"
}
}
}
},
"responses": {
"201": {
"description": "Todo created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
},
"examples": {
"new_todo": {
"summary": "A newly created todo",
"value": {
"id": 4,
"title": "Deploy application",
"completed": false,
"userId": 789
}
}
}
}
}
},
"400": {
"description": "Invalid request body"
}
},
"operationId": "create-a-new-todo",
"x-zuplo-route": {
"corsPolicy": "none",
"handler": {
"export": "urlForwardHandler",
"module": "$import(@zuplo/runtime)",
"options": {
"baseUrl": "https://todo.zuplo.io"
}
}
},
"tags": ["Todo"]
}
},
"/todos/{id}": {
"put": {
"summary": "Update a todo",
"description": "**Updates an existing todo item** by its unique identifier. You can modify any combination of the todo's properties including title, completion status, and user assignment. All changes are applied atomically to ensure data consistency.",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
},
"description": "The todo ID"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateTodo"
}
}
}
},
"responses": {
"200": {
"description": "Todo updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
},
"examples": {
"updated_todo": {
"summary": "A todo that has been updated",
"value": {
"id": 1,
"title": "Buy groceries and cook dinner",
"completed": true,
"userId": 123
}
}
}
}
}
},
"400": {
"description": "Invalid request body"
},
"404": {
"description": "Todo not found"
}
},
"operationId": "update-todo",
"x-zuplo-route": {
"corsPolicy": "none",
"handler": {
"export": "urlForwardHandler",
"module": "$import(@zuplo/runtime)",
"options": {
"baseUrl": "https://todo.zuplo.io"
}
}
},
"tags": ["Todo"]
},
"delete": {
"summary": "Delete a todo",
"description": "**Permanently removes a todo item** from the system using its unique identifier. This operation cannot be undone, so use with caution. The endpoint will return a 404 error if the specified todo does not exist.",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
},
"description": "The todo ID"
}
],
"responses": {
"204": {
"description": "Todo deleted successfully"
},
"404": {
"description": "Todo not found"
}
},
"operationId": "delete-todo",
"x-zuplo-route": {
"corsPolicy": "none",
"handler": {
"export": "urlForwardHandler",
"module": "$import(@zuplo/runtime)",
"options": {
"baseUrl": "https://todo.zuplo.io"
}
}
},
"tags": ["Todo"]
}
}
},
"components": {
"schemas": {
"Todo": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The todo ID"
},
"title": {
"type": "string",
"description": "The todo title"
},
"completed": {
"type": "boolean",
"description": "Whether the todo is completed"
},
"userId": {
"type": "integer",
"description": "The user ID who owns the todo"
}
},
"required": ["id", "title", "completed", "userId"]
},
"CreateTodo": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "The todo title"
},
"completed": {
"type": "boolean",
"description": "Whether the todo is completed",
"default": false
},
"userId": {
"type": "integer",
"description": "The user ID who owns the todo"
}
},
"required": ["title", "userId"]
},
"UpdateTodo": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "The todo title"
},
"completed": {
"type": "boolean",
"description": "Whether the todo is completed"
},
"userId": {
"type": "integer",
"description": "The user ID who owns the todo"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment