openapi: 3.1.0 info: title: AIDD Todo API version: 2.0.0 description: | RESTful API for managing todo tasks with in-memory storage. **Phase**: 2 - Foundation API & Monorepo Skeleton **Storage**: In-memory dictionary (no database persistence) **Authentication**: Not implemented in this phase servers: - url: http://localhost:8000 description: Local development server tags: - name: tasks description: Task management operations paths: /tasks: get: summary: List all tasks description: Retrieve all tasks from in-memory storage operationId: getAllTasks tags: - tasks responses: '200': description: List of all tasks (empty array if no tasks exist) content: application/json: schema: type: array items: $ref: '#/components/schemas/TaskResponse' examples: with_tasks: summary: Multiple tasks value: - id: 1 title: "Buy groceries" description: "Milk, eggs, bread" status: "Pending" - id: 2 title: "Call dentist" description: "" status: "Completed" empty: summary: No tasks value: [] post: summary: Create a new task description: Create a new task with auto-generated ID and PENDING status operationId: createTask tags: - tasks requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TaskCreate' examples: with_description: summary: Task with description value: title: "Buy groceries" description: "Milk, eggs, bread" without_description: summary: Task without description value: title: "Call dentist" responses: '201': description: Task created successfully content: application/json: schema: $ref: '#/components/schemas/TaskResponse' example: id: 1 title: "Buy groceries" description: "Milk, eggs, bread" status: "Pending" '422': description: Validation error (empty or whitespace-only title) content: application/json: schema: $ref: '#/components/schemas/ValidationError' example: detail: - loc: ["body", "title"] msg: "Title cannot be empty or whitespace-only" type: "value_error" /tasks/{id}: get: summary: Get a task by ID description: Retrieve a specific task by its unique identifier operationId: getTaskById tags: - tasks parameters: - $ref: '#/components/parameters/TaskId' responses: '200': description: Task found content: application/json: schema: $ref: '#/components/schemas/TaskResponse' example: id: 1 title: "Buy groceries" description: "Milk, eggs, bread" status: "Pending" '404': description: Task not found content: application/json: schema: $ref: '#/components/schemas/NotFoundError' example: detail: "Task with ID 999 not found" put: summary: Update a task description: Update a task's title and/or description (partial updates allowed) operationId: updateTask tags: - tasks parameters: - $ref: '#/components/parameters/TaskId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TaskUpdate' examples: update_title: summary: Update only title value: title: "Buy groceries and cook dinner" update_description: summary: Update only description value: description: "Updated description" update_both: summary: Update both fields value: title: "New title" description: "New description" clear_description: summary: Clear description value: description: "" responses: '200': description: Task updated successfully content: application/json: schema: $ref: '#/components/schemas/TaskResponse' example: id: 1 title: "Buy groceries and cook dinner" description: "Milk, eggs, bread" status: "Pending" '404': description: Task not found content: application/json: schema: $ref: '#/components/schemas/NotFoundError' example: detail: "Task with ID 999 not found" '422': description: Validation error (empty or whitespace-only title) content: application/json: schema: $ref: '#/components/schemas/ValidationError' example: detail: - loc: ["body", "title"] msg: "Title cannot be empty or whitespace-only" type: "value_error" delete: summary: Delete a task description: Permanently remove a task from storage (ID will not be reused) operationId: deleteTask tags: - tasks parameters: - $ref: '#/components/parameters/TaskId' responses: '204': description: Task deleted successfully (no response body) '404': description: Task not found content: application/json: schema: $ref: '#/components/schemas/NotFoundError' example: detail: "Task with ID 999 not found" components: parameters: TaskId: name: id in: path required: true description: Unique task identifier schema: type: integer minimum: 1 example: 1 schemas: TaskStatus: type: string enum: - "Pending" - "Completed" description: Task completion status TaskCreate: type: object required: - title properties: title: type: string minLength: 1 description: Task title (required, non-empty, whitespace-stripped) example: "Buy groceries" description: type: string description: Optional task description (defaults to empty string) default: "" example: "Milk, eggs, bread" TaskUpdate: type: object properties: title: type: string minLength: 1 description: New title (optional, if provided must be non-empty) example: "Buy groceries and cook dinner" description: type: string description: New description (optional, can be empty to clear) example: "Updated description" description: At least one field should be provided for a meaningful update TaskResponse: type: object required: - id - title - description - status properties: id: type: integer description: Unique auto-generated task identifier example: 1 title: type: string description: Task title (non-empty) example: "Buy groceries" description: type: string description: Task description (can be empty string) example: "Milk, eggs, bread" status: $ref: '#/components/schemas/TaskStatus' ValidationError: type: object properties: detail: type: array items: type: object properties: loc: type: array items: type: string description: Location of the error (e.g., ["body", "title"]) msg: type: string description: Error message type: type: string description: Error type identifier NotFoundError: type: object properties: detail: type: string description: Error message explaining what was not found example: "Task with ID 999 not found"