Documentation
Document APIs with descriptions, examples, formats, and deprecation notices at every level
API Definition
config/apis/brave_eagle.rb
rb
# frozen_string_literal: true
Apiwork::API.define '/brave_eagle' do
key_format :camel
export :openapi
export :typescript
export :zod
info do
title 'Task Management API'
version '1.0.0'
description 'API for managing tasks and projects'
contact do
name 'API Support'
email 'support@example.com'
end
license do
name 'MIT'
url 'https://opensource.org/licenses/MIT'
end
end
resources :tasks do
member do
patch :archive
end
end
endModels
app/models/brave_eagle/task.rb
rb
# frozen_string_literal: true
module BraveEagle
class Task < ApplicationRecord
belongs_to :assignee, class_name: 'User', inverse_of: :assigned_tasks, optional: true
has_many :comments, dependent: :destroy
validates :title, presence: true
def archive!
update!(archived: true)
end
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| archived | boolean | ✓ | |
| assignee_id | string | ✓ | |
| created_at | datetime | ||
| description | text | ✓ | |
| due_date | datetime | ✓ | |
| priority | string | ✓ | medium |
| status | string | ✓ | pending |
| title | string | ||
| updated_at | datetime |
app/models/brave_eagle/user.rb
rb
# frozen_string_literal: true
module BraveEagle
class User < ApplicationRecord
has_many :assigned_tasks, class_name: 'Task', dependent: :nullify, foreign_key: :assignee_id, inverse_of: :assignee
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| created_at | datetime | ||
| string | |||
| name | string | ||
| updated_at | datetime |
app/models/brave_eagle/comment.rb
rb
# frozen_string_literal: true
module BraveEagle
class Comment < ApplicationRecord
belongs_to :task
end
endDatabase Table
| Column | Type | Nullable | Default |
|---|---|---|---|
| id | string | ||
| author_name | string | ✓ | |
| body | text | ||
| created_at | datetime | ||
| task_id | string | ||
| updated_at | datetime |
Representations
app/representations/brave_eagle/task_representation.rb
rb
# frozen_string_literal: true
module BraveEagle
class TaskRepresentation < Apiwork::Representation::Base
description 'A task representing work to be completed'
attribute :id, description: 'Unique task identifier'
attribute :title, description: 'Short title describing the task', example: 'Implement user authentication', writable: true
attribute :description,
description: 'Detailed description of what needs to be done',
example: 'Add OAuth2 login support for Google and GitHub providers',
writable: true
attribute :status,
description: 'Current status of the task',
enum: %w[pending in_progress completed archived],
example: 'pending',
filterable: true,
writable: true
attribute :priority,
description: 'Priority level for task ordering',
enum: %w[low medium high critical],
example: 'high',
filterable: true,
writable: true
attribute :due_date, description: 'Target date for task completion', example: '2024-02-01T00:00:00Z', sortable: true, writable: true
attribute :archived, deprecated: true, description: 'Whether the task has been archived'
attribute :created_at, description: 'Timestamp when the task was created', sortable: true
attribute :updated_at, description: 'Timestamp of last modification', sortable: true
belongs_to :assignee, description: 'User responsible for completing this task'
has_many :comments, description: 'Discussion comments on this task'
end
endapp/representations/brave_eagle/user_representation.rb
rb
# frozen_string_literal: true
module BraveEagle
class UserRepresentation < Apiwork::Representation::Base
description 'A user who can be assigned to tasks'
attribute :id, description: 'Unique user identifier'
attribute :name, description: "User's display name", example: 'Jane Doe'
attribute :email, description: "User's email address", example: 'jane@example.com', format: :email
end
endapp/representations/brave_eagle/comment_representation.rb
rb
# frozen_string_literal: true
module BraveEagle
class CommentRepresentation < Apiwork::Representation::Base
description 'A comment on a task'
attribute :id, description: 'Unique comment identifier'
attribute :body, description: 'Comment content', example: 'This looks good, ready for review.', writable: true
attribute :author_name, description: 'Name of the person who wrote the comment', example: 'John Doe', writable: true
attribute :created_at, description: 'When the comment was created'
attribute :updated_at, description: 'When the comment was last updated'
end
endContracts
app/contracts/brave_eagle/task_contract.rb
rb
# frozen_string_literal: true
module BraveEagle
class TaskContract < Apiwork::Contract::Base
representation TaskRepresentation
action :index do
summary 'List all tasks'
description 'Returns a paginated list of tasks with optional filtering by status and priority'
tags 'Tasks', 'Core'
operation_id 'listTasks'
end
action :show do
summary 'Get task details'
description 'Returns a single task by ID'
tags 'Tasks'
operation_id 'getTask'
end
action :create do
summary 'Create a new task'
description 'Creates a task and returns the created resource'
tags 'Tasks'
operation_id 'createTask'
end
action :update do
summary 'Update a task'
description 'Updates an existing task'
tags 'Tasks'
operation_id 'updateTask'
end
action :destroy do
summary 'Delete a task'
description 'Permanently removes a task'
tags 'Tasks'
operation_id 'deleteTask'
end
action :archive do
summary 'Archive a task'
description 'Marks a task as archived. Archived tasks are hidden from default listings but can still be retrieved.'
tags 'Tasks', 'Lifecycle'
operation_id 'archiveTask'
deprecated!
end
end
endControllers
app/controllers/brave_eagle/tasks_controller.rb
rb
# frozen_string_literal: true
module BraveEagle
class TasksController < ApplicationController
before_action :set_task, only: %i[show update destroy archive]
def index
tasks = Task.all
expose tasks
end
def show
expose task
end
def create
task = Task.create(contract.body[:task])
expose task
end
def update
task.update(contract.body[:task])
expose task
end
def destroy
task.destroy
expose task
end
def archive
task.archive!
expose task
end
private
attr_reader :task
def set_task
@task = Task.find(params[:id])
end
end
endRequest Examples
List all tasks
Request
http
GET /brave_eagle/tasksResponse 200
json
{
"tasks": [
{
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "Write documentation",
"description": "Complete the API reference guide",
"status": "pending",
"priority": "high",
"dueDate": null,
"archived": false,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z"
},
{
"id": "87bd2ab1-033b-5369-b8e7-687307ff4f1b",
"title": "Review pull request",
"description": null,
"status": "completed",
"priority": "medium",
"dueDate": null,
"archived": false,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z"
}
],
"pagination": {
"items": 2,
"total": 1,
"current": 1,
"next": null,
"prev": null
}
}Get task details
Request
http
GET /brave_eagle/tasks/eaa10144-98eb-559c-abf3-2ad6e649e9bfResponse 404
json
{
"status": 404,
"error": "Not Found"
}Create a task
Request
http
POST /brave_eagle/tasks
Content-Type: application/json
{
"task": {
"title": "New feature implementation",
"description": "Implement the new dashboard widget",
"status": "pending",
"priority": "high",
"dueDate": "2024-02-01"
}
}Response 201
json
{
"task": {
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "New feature implementation",
"description": "Implement the new dashboard widget",
"status": "pending",
"priority": "high",
"dueDate": "2024-02-01T00:00:00.000Z",
"archived": false,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z"
}
}Archive a task (deprecated)
Request
http
PATCH /brave_eagle/tasks/0ec28309-26a2-5f19-92c0-3b60b8796f2e/archiveResponse 200
json
{
"task": {
"id": "0ec28309-26a2-5f19-92c0-3b60b8796f2e",
"title": "Old task to archive",
"description": null,
"status": "completed",
"priority": "medium",
"dueDate": null,
"archived": true,
"createdAt": "2024-01-01T12:00:00.000Z",
"updatedAt": "2024-01-01T12:00:00.000Z"
}
}Generated Output
Introspection
json
{
"base_path": "/brave_eagle",
"enums": {
"layer": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"http",
"contract",
"domain"
]
},
"sort_direction": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"asc",
"desc"
]
},
"task_priority": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"low",
"medium",
"high",
"critical"
]
},
"task_status": {
"deprecated": false,
"description": null,
"example": null,
"values": [
"pending",
"in_progress",
"completed",
"archived"
]
}
},
"error_codes": {
"unprocessable_entity": {
"description": "Unprocessable Entity",
"status": 422
}
},
"info": {
"contact": {
"email": "support@example.com",
"name": "API Support",
"url": null
},
"description": "API for managing tasks and projects",
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"servers": [],
"summary": null,
"terms_of_service": null,
"title": "Task Management API",
"version": "1.0.0"
},
"resources": {
"tasks": {
"actions": {
"index": {
"deprecated": false,
"description": "Returns a paginated list of tasks with optional filtering by status and priority",
"method": "get",
"operation_id": "listTasks",
"path": "/tasks",
"raises": [],
"request": {
"body": {},
"query": {
"filter": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_filter"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_filter"
},
"shape": {}
}
]
},
"include": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
},
"page": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_page"
},
"sort": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_sort"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_sort"
},
"shape": {}
}
]
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_index_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": "List all tasks",
"tags": [
"Tasks",
"Core"
]
},
"show": {
"deprecated": false,
"description": "Returns a single task by ID",
"method": "get",
"operation_id": "getTask",
"path": "/tasks/:id",
"raises": [],
"request": {
"body": {},
"query": {
"include": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_show_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": "Get task details",
"tags": [
"Tasks"
]
},
"create": {
"deprecated": false,
"description": "Creates a task and returns the created resource",
"method": "post",
"operation_id": "createTask",
"path": "/tasks",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {
"task": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_create_payload"
}
},
"query": {
"include": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_create_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": "Create a new task",
"tags": [
"Tasks"
]
},
"update": {
"deprecated": false,
"description": "Updates an existing task",
"method": "patch",
"operation_id": "updateTask",
"path": "/tasks/:id",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {
"task": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_update_payload"
}
},
"query": {
"include": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_update_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": "Update a task",
"tags": [
"Tasks"
]
},
"destroy": {
"deprecated": false,
"description": "Permanently removes a task",
"method": "delete",
"operation_id": "deleteTask",
"path": "/tasks/:id",
"raises": [],
"request": {
"body": {},
"query": {
"include": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": null
},
"no_content": true
},
"summary": "Delete a task",
"tags": [
"Tasks"
]
},
"archive": {
"deprecated": true,
"description": "Marks a task as archived. Archived tasks are hidden from default listings but can still be retrieved.",
"method": "patch",
"operation_id": "archiveTask",
"path": "/tasks/:id/archive",
"raises": [
"unprocessable_entity"
],
"request": {
"body": {},
"query": {
"include": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_include"
}
}
},
"response": {
"body": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "union",
"discriminator": null,
"variants": [
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_archive_success_response_body"
},
{
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "error_response_body"
}
]
},
"no_content": false
},
"summary": "Archive a task",
"tags": [
"Tasks",
"Lifecycle"
]
}
},
"identifier": "tasks",
"parent_identifiers": [],
"path": "tasks",
"resources": {}
}
},
"types": {
"comment": {
"deprecated": false,
"description": "A comment on a task",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"author_name": {
"default": null,
"deprecated": false,
"description": "Name of the person who wrote the comment",
"example": "John Doe",
"nullable": true,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"body": {
"default": null,
"deprecated": false,
"description": "Comment content",
"example": "This looks good, ready for review.",
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"created_at": {
"default": null,
"deprecated": false,
"description": "When the comment was created",
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"id": {
"default": null,
"deprecated": false,
"description": "Unique comment identifier",
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"updated_at": {
"default": null,
"deprecated": false,
"description": "When the comment was last updated",
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
}
},
"type": "object",
"variants": []
},
"comment_create_payload": {
"deprecated": false,
"description": "A comment on a task",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"author_name": {
"default": null,
"deprecated": false,
"description": "Name of the person who wrote the comment",
"example": "John Doe",
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"body": {
"default": null,
"deprecated": false,
"description": "Comment content",
"example": "This looks good, ready for review.",
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"comment_update_payload": {
"deprecated": false,
"description": "A comment on a task",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"author_name": {
"default": null,
"deprecated": false,
"description": "Name of the person who wrote the comment",
"example": "John Doe",
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"body": {
"default": null,
"deprecated": false,
"description": "Comment content",
"example": "This looks good, ready for review.",
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"error": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"issues": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "issue"
},
"shape": {}
},
"layer": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "layer"
}
},
"type": "object",
"variants": []
},
"error_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [
"error"
],
"shape": {},
"type": "object",
"variants": []
},
"issue": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"code": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"detail": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": false,
"shape": {}
},
"path": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "string",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"pointer": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"nullable_string_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"contains": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"ends_with": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "string",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"null": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "boolean"
},
"starts_with": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"offset_pagination": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"current": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"items": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"next": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"prev": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": true,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": null
},
"total": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "integer",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"string_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"contains": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"ends_with": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "string",
"format": null,
"max": null,
"min": null
},
"shape": {}
},
"starts_with": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"task": {
"deprecated": false,
"description": "A task representing work to be completed",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"archived": {
"default": null,
"deprecated": true,
"description": "Whether the task has been archived",
"example": null,
"nullable": true,
"optional": false,
"type": "boolean"
},
"assignee": {
"default": null,
"deprecated": false,
"description": "User responsible for completing this task",
"example": null,
"nullable": true,
"optional": true,
"type": "reference",
"reference": "user"
},
"comments": {
"default": null,
"deprecated": false,
"description": "Discussion comments on this task",
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "comment"
},
"shape": {}
},
"created_at": {
"default": null,
"deprecated": false,
"description": "Timestamp when the task was created",
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
},
"description": {
"default": null,
"deprecated": false,
"description": "Detailed description of what needs to be done",
"example": "Add OAuth2 login support for Google and GitHub providers",
"nullable": true,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"due_date": {
"default": null,
"deprecated": false,
"description": "Target date for task completion",
"example": "2024-02-01T00:00:00Z",
"nullable": true,
"optional": false,
"type": "datetime"
},
"id": {
"default": null,
"deprecated": false,
"description": "Unique task identifier",
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"priority": {
"default": null,
"deprecated": false,
"description": "Priority level for task ordering",
"example": "high",
"nullable": true,
"optional": false,
"type": "string",
"enum": "task_priority",
"format": null,
"max": null,
"min": null
},
"status": {
"default": null,
"deprecated": false,
"description": "Current status of the task",
"example": "pending",
"nullable": true,
"optional": false,
"type": "string",
"enum": "task_status",
"format": null,
"max": null,
"min": null
},
"title": {
"default": null,
"deprecated": false,
"description": "Short title describing the task",
"example": "Implement user authentication",
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"updated_at": {
"default": null,
"deprecated": false,
"description": "Timestamp of last modification",
"example": null,
"nullable": false,
"optional": false,
"type": "datetime"
}
},
"type": "object",
"variants": []
},
"task_archive_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"task": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
},
"type": "object",
"variants": []
},
"task_create_payload": {
"deprecated": false,
"description": "A task representing work to be completed",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"description": {
"default": null,
"deprecated": false,
"description": "Detailed description of what needs to be done",
"example": "Add OAuth2 login support for Google and GitHub providers",
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"due_date": {
"default": null,
"deprecated": false,
"description": "Target date for task completion",
"example": "2024-02-01T00:00:00Z",
"nullable": true,
"optional": true,
"type": "datetime"
},
"priority": {
"default": null,
"deprecated": false,
"description": "Priority level for task ordering",
"example": "high",
"nullable": true,
"optional": true,
"type": "string",
"enum": "task_priority",
"format": null,
"max": null,
"min": null
},
"status": {
"default": null,
"deprecated": false,
"description": "Current status of the task",
"example": "pending",
"nullable": true,
"optional": true,
"type": "string",
"enum": "task_status",
"format": null,
"max": null,
"min": null
},
"title": {
"default": null,
"deprecated": false,
"description": "Short title describing the task",
"example": "Implement user authentication",
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"task_create_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"task": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
},
"type": "object",
"variants": []
},
"task_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"AND": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_filter"
},
"shape": {}
},
"NOT": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_filter"
},
"OR": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_filter"
},
"shape": {}
},
"priority": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_priority_filter"
},
"status": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "task_status_filter"
}
},
"type": "object",
"variants": []
},
"task_include": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"assignee": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "boolean"
},
"comments": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "boolean"
}
},
"type": "object",
"variants": []
},
"task_index_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"pagination": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "offset_pagination"
},
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"tasks": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task"
},
"shape": {}
}
},
"type": "object",
"variants": []
},
"task_page": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"number": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": null,
"min": 1
},
"size": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "integer",
"format": null,
"max": 100,
"min": 1
}
},
"type": "object",
"variants": []
},
"task_priority_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"type": "union",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_priority"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": true,
"shape": {
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_priority"
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_priority"
},
"shape": {}
}
}
}
]
},
"task_show_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"task": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
},
"type": "object",
"variants": []
},
"task_sort": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"created_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
"due_date": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
},
"updated_at": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "reference",
"reference": "sort_direction"
}
},
"type": "object",
"variants": []
},
"task_status_filter": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"type": "union",
"variants": [
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_status"
},
{
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "object",
"partial": true,
"shape": {
"eq": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task_status"
},
"in": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "array",
"max": null,
"min": null,
"of": {
"default": null,
"deprecated": null,
"description": null,
"example": null,
"nullable": null,
"optional": null,
"type": "reference",
"reference": "task_status"
},
"shape": {}
}
}
}
]
},
"task_update_payload": {
"deprecated": false,
"description": "A task representing work to be completed",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"description": {
"default": null,
"deprecated": false,
"description": "Detailed description of what needs to be done",
"example": "Add OAuth2 login support for Google and GitHub providers",
"nullable": true,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
},
"due_date": {
"default": null,
"deprecated": false,
"description": "Target date for task completion",
"example": "2024-02-01T00:00:00Z",
"nullable": true,
"optional": true,
"type": "datetime"
},
"priority": {
"default": null,
"deprecated": false,
"description": "Priority level for task ordering",
"example": "high",
"nullable": true,
"optional": true,
"type": "string",
"enum": "task_priority",
"format": null,
"max": null,
"min": null
},
"status": {
"default": null,
"deprecated": false,
"description": "Current status of the task",
"example": "pending",
"nullable": true,
"optional": true,
"type": "string",
"enum": "task_status",
"format": null,
"max": null,
"min": null
},
"title": {
"default": null,
"deprecated": false,
"description": "Short title describing the task",
"example": "Implement user authentication",
"nullable": false,
"optional": true,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"task_update_success_response_body": {
"deprecated": false,
"description": null,
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"meta": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": true,
"type": "object",
"partial": false,
"shape": {}
},
"task": {
"default": null,
"deprecated": false,
"description": null,
"example": null,
"nullable": false,
"optional": false,
"type": "reference",
"reference": "task"
}
},
"type": "object",
"variants": []
},
"user": {
"deprecated": false,
"description": "A user who can be assigned to tasks",
"discriminator": null,
"example": null,
"extends": [],
"shape": {
"email": {
"default": null,
"deprecated": false,
"description": "User's email address",
"example": "jane@example.com",
"nullable": false,
"optional": false,
"type": "string",
"format": "email",
"max": null,
"min": null
},
"id": {
"default": null,
"deprecated": false,
"description": "Unique user identifier",
"example": null,
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
},
"name": {
"default": null,
"deprecated": false,
"description": "User's display name",
"example": "Jane Doe",
"nullable": false,
"optional": false,
"type": "string",
"format": null,
"max": null,
"min": null
}
},
"type": "object",
"variants": []
},
"user_create_payload": {
"deprecated": false,
"description": "A user who can be assigned to tasks",
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"type": "object",
"variants": []
},
"user_update_payload": {
"deprecated": false,
"description": "A user who can be assigned to tasks",
"discriminator": null,
"example": null,
"extends": [],
"shape": {},
"type": "object",
"variants": []
}
}
}TypeScript
ts
/** A comment on a task */
export interface Comment {
/**
* Name of the person who wrote the comment
* @example "John Doe"
*/
authorName: null | string;
/**
* Comment content
* @example "This looks good, ready for review."
*/
body: string;
/** When the comment was created */
createdAt: string;
/** Unique comment identifier */
id: string;
/** When the comment was last updated */
updatedAt: string;
}
export interface Error {
issues: Issue[];
layer: Layer;
}
export type ErrorResponseBody = Error;
export interface Issue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string[];
pointer: string;
}
export type Layer = 'contract' | 'domain' | 'http';
export interface OffsetPagination {
current: number;
items: number;
next?: null | number;
prev?: null | number;
total: number;
}
export type SortDirection = 'asc' | 'desc';
/** A task representing work to be completed */
export interface Task {
/** Whether the task has been archived */
archived: boolean | null;
/** User responsible for completing this task */
assignee?: User | null;
/** Discussion comments on this task */
comments?: Comment[];
/** Timestamp when the task was created */
createdAt: string;
/**
* Detailed description of what needs to be done
* @example "Add OAuth2 login support for Google and GitHub providers"
*/
description: null | string;
/**
* Target date for task completion
* @example "2024-02-01T00:00:00Z"
*/
dueDate: null | string;
/** Unique task identifier */
id: string;
/**
* Priority level for task ordering
* @example "high"
*/
priority: TaskPriority | null;
/**
* Current status of the task
* @example "pending"
*/
status: TaskStatus | null;
/**
* Short title describing the task
* @example "Implement user authentication"
*/
title: string;
/** Timestamp of last modification */
updatedAt: string;
}
export interface TaskArchiveSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
/** A task representing work to be completed */
export interface TaskCreatePayload {
/**
* Detailed description of what needs to be done
* @example "Add OAuth2 login support for Google and GitHub providers"
*/
description?: null | string;
/**
* Target date for task completion
* @example "2024-02-01T00:00:00Z"
*/
dueDate?: null | string;
/**
* Priority level for task ordering
* @example "high"
*/
priority?: TaskPriority | null;
/**
* Current status of the task
* @example "pending"
*/
status?: TaskStatus | null;
/**
* Short title describing the task
* @example "Implement user authentication"
*/
title: string;
}
export interface TaskCreateSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
export interface TaskFilter {
AND?: TaskFilter[];
NOT?: TaskFilter;
OR?: TaskFilter[];
priority?: TaskPriorityFilter;
status?: TaskStatusFilter;
}
export interface TaskInclude {
assignee?: boolean;
comments?: boolean;
}
export interface TaskIndexSuccessResponseBody {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
tasks: Task[];
}
export interface TaskPage {
number?: number;
size?: number;
}
export type TaskPriority = 'critical' | 'high' | 'low' | 'medium';
export type TaskPriorityFilter = TaskPriority | { eq?: TaskPriority; in?: TaskPriority[] };
export interface TaskShowSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
export interface TaskSort {
createdAt?: SortDirection;
dueDate?: SortDirection;
updatedAt?: SortDirection;
}
export type TaskStatus = 'archived' | 'completed' | 'in_progress' | 'pending';
export type TaskStatusFilter = TaskStatus | { eq?: TaskStatus; in?: TaskStatus[] };
/** A task representing work to be completed */
export interface TaskUpdatePayload {
/**
* Detailed description of what needs to be done
* @example "Add OAuth2 login support for Google and GitHub providers"
*/
description?: null | string;
/**
* Target date for task completion
* @example "2024-02-01T00:00:00Z"
*/
dueDate?: null | string;
/**
* Priority level for task ordering
* @example "high"
*/
priority?: TaskPriority | null;
/**
* Current status of the task
* @example "pending"
*/
status?: TaskStatus | null;
/**
* Short title describing the task
* @example "Implement user authentication"
*/
title?: string;
}
export interface TaskUpdateSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
export interface TasksArchiveRequest {
query: TasksArchiveRequestQuery;
}
export interface TasksArchiveRequestQuery {
include?: TaskInclude;
}
export interface TasksArchiveResponse {
body: TasksArchiveResponseBody;
}
export type TasksArchiveResponseBody = ErrorResponseBody | TaskArchiveSuccessResponseBody;
export interface TasksCreateRequest {
query: TasksCreateRequestQuery;
body: TasksCreateRequestBody;
}
export interface TasksCreateRequestBody {
task: TaskCreatePayload;
}
export interface TasksCreateRequestQuery {
include?: TaskInclude;
}
export interface TasksCreateResponse {
body: TasksCreateResponseBody;
}
export type TasksCreateResponseBody = ErrorResponseBody | TaskCreateSuccessResponseBody;
export interface TasksDestroyRequest {
query: TasksDestroyRequestQuery;
}
export interface TasksDestroyRequestQuery {
include?: TaskInclude;
}
export type TasksDestroyResponse = never;
export interface TasksIndexRequest {
query: TasksIndexRequestQuery;
}
export interface TasksIndexRequestQuery {
filter?: TaskFilter | TaskFilter[];
include?: TaskInclude;
page?: TaskPage;
sort?: TaskSort | TaskSort[];
}
export interface TasksIndexResponse {
body: TasksIndexResponseBody;
}
export type TasksIndexResponseBody = ErrorResponseBody | TaskIndexSuccessResponseBody;
export interface TasksShowRequest {
query: TasksShowRequestQuery;
}
export interface TasksShowRequestQuery {
include?: TaskInclude;
}
export interface TasksShowResponse {
body: TasksShowResponseBody;
}
export type TasksShowResponseBody = ErrorResponseBody | TaskShowSuccessResponseBody;
export interface TasksUpdateRequest {
query: TasksUpdateRequestQuery;
body: TasksUpdateRequestBody;
}
export interface TasksUpdateRequestBody {
task: TaskUpdatePayload;
}
export interface TasksUpdateRequestQuery {
include?: TaskInclude;
}
export interface TasksUpdateResponse {
body: TasksUpdateResponseBody;
}
export type TasksUpdateResponseBody = ErrorResponseBody | TaskUpdateSuccessResponseBody;
/** A user who can be assigned to tasks */
export interface User {
/**
* User's email address
* @example "jane@example.com"
*/
email: string;
/** Unique user identifier */
id: string;
/**
* User's display name
* @example "Jane Doe"
*/
name: string;
}Zod
ts
import { z } from 'zod';
export const LayerSchema = z.enum(['contract', 'domain', 'http']);
export const SortDirectionSchema = z.enum(['asc', 'desc']);
export const TaskPrioritySchema = z.enum(['critical', 'high', 'low', 'medium']);
export const TaskStatusSchema = z.enum(['archived', 'completed', 'in_progress', 'pending']);
export const TaskFilterSchema: z.ZodType<TaskFilter> = z.lazy(() => z.object({
AND: z.array(TaskFilterSchema).optional(),
NOT: TaskFilterSchema.optional(),
OR: z.array(TaskFilterSchema).optional(),
priority: TaskPriorityFilterSchema.optional(),
status: TaskStatusFilterSchema.optional()
}));
export const CommentSchema = z.object({
authorName: z.string().nullable(),
body: z.string(),
createdAt: z.iso.datetime(),
id: z.string(),
updatedAt: z.iso.datetime()
});
export const IssueSchema = z.object({
code: z.string(),
detail: z.string(),
meta: z.record(z.string(), z.unknown()),
path: z.array(z.string()),
pointer: z.string()
});
export const OffsetPaginationSchema = z.object({
current: z.number().int(),
items: z.number().int(),
next: z.number().int().nullable().optional(),
prev: z.number().int().nullable().optional(),
total: z.number().int()
});
export const TaskCreatePayloadSchema = z.object({
description: z.string().nullable().optional(),
dueDate: z.iso.datetime().nullable().optional(),
priority: TaskPrioritySchema.nullable().optional(),
status: TaskStatusSchema.nullable().optional(),
title: z.string()
});
export const TaskIncludeSchema = z.object({
assignee: z.boolean().optional(),
comments: z.boolean().optional()
});
export const TaskPageSchema = z.object({
number: z.number().int().min(1).optional(),
size: z.number().int().min(1).max(100).optional()
});
export const TaskPriorityFilterSchema = z.union([
TaskPrioritySchema,
z.object({ eq: TaskPrioritySchema, in: z.array(TaskPrioritySchema) }).partial()
]);
export const TaskSortSchema = z.object({
createdAt: SortDirectionSchema.optional(),
dueDate: SortDirectionSchema.optional(),
updatedAt: SortDirectionSchema.optional()
});
export const TaskStatusFilterSchema = z.union([
TaskStatusSchema,
z.object({ eq: TaskStatusSchema, in: z.array(TaskStatusSchema) }).partial()
]);
export const TaskUpdatePayloadSchema = z.object({
description: z.string().nullable().optional(),
dueDate: z.iso.datetime().nullable().optional(),
priority: TaskPrioritySchema.nullable().optional(),
status: TaskStatusSchema.nullable().optional(),
title: z.string().optional()
});
export const UserSchema = z.object({
email: z.email(),
id: z.string(),
name: z.string()
});
export const ErrorSchema = z.object({
issues: z.array(IssueSchema),
layer: LayerSchema
});
export const TaskSchema = z.object({
archived: z.boolean().nullable(),
assignee: UserSchema.nullable().optional(),
comments: z.array(CommentSchema).optional(),
createdAt: z.iso.datetime(),
description: z.string().nullable(),
dueDate: z.iso.datetime().nullable(),
id: z.string(),
priority: TaskPrioritySchema.nullable(),
status: TaskStatusSchema.nullable(),
title: z.string(),
updatedAt: z.iso.datetime()
});
export const ErrorResponseBodySchema = ErrorSchema;
export const TaskArchiveSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema
});
export const TaskCreateSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema
});
export const TaskIndexSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
pagination: OffsetPaginationSchema,
tasks: z.array(TaskSchema)
});
export const TaskShowSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema
});
export const TaskUpdateSuccessResponseBodySchema = z.object({
meta: z.record(z.string(), z.unknown()).optional(),
task: TaskSchema
});
export const TasksIndexRequestQuerySchema = z.object({
filter: z.union([TaskFilterSchema, z.array(TaskFilterSchema)]).optional(),
include: TaskIncludeSchema.optional(),
page: TaskPageSchema.optional(),
sort: z.union([TaskSortSchema, z.array(TaskSortSchema)]).optional()
});
export const TasksIndexRequestSchema = z.object({
query: TasksIndexRequestQuerySchema
});
export const TasksIndexResponseBodySchema = z.union([TaskIndexSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const TasksIndexResponseSchema = z.object({
body: TasksIndexResponseBodySchema
});
export const TasksShowRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional()
});
export const TasksShowRequestSchema = z.object({
query: TasksShowRequestQuerySchema
});
export const TasksShowResponseBodySchema = z.union([TaskShowSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const TasksShowResponseSchema = z.object({
body: TasksShowResponseBodySchema
});
export const TasksCreateRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional()
});
export const TasksCreateRequestBodySchema = z.object({
task: TaskCreatePayloadSchema
});
export const TasksCreateRequestSchema = z.object({
query: TasksCreateRequestQuerySchema,
body: TasksCreateRequestBodySchema
});
export const TasksCreateResponseBodySchema = z.union([TaskCreateSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const TasksCreateResponseSchema = z.object({
body: TasksCreateResponseBodySchema
});
export const TasksUpdateRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional()
});
export const TasksUpdateRequestBodySchema = z.object({
task: TaskUpdatePayloadSchema
});
export const TasksUpdateRequestSchema = z.object({
query: TasksUpdateRequestQuerySchema,
body: TasksUpdateRequestBodySchema
});
export const TasksUpdateResponseBodySchema = z.union([TaskUpdateSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const TasksUpdateResponseSchema = z.object({
body: TasksUpdateResponseBodySchema
});
export const TasksDestroyRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional()
});
export const TasksDestroyRequestSchema = z.object({
query: TasksDestroyRequestQuerySchema
});
export const TasksDestroyResponseSchema = z.never();
export const TasksArchiveRequestQuerySchema = z.object({
include: TaskIncludeSchema.optional()
});
export const TasksArchiveRequestSchema = z.object({
query: TasksArchiveRequestQuerySchema
});
export const TasksArchiveResponseBodySchema = z.union([TaskArchiveSuccessResponseBodySchema, ErrorResponseBodySchema]);
export const TasksArchiveResponseSchema = z.object({
body: TasksArchiveResponseBodySchema
});
/** A comment on a task */
export interface Comment {
/**
* Name of the person who wrote the comment
* @example "John Doe"
*/
authorName: null | string;
/**
* Comment content
* @example "This looks good, ready for review."
*/
body: string;
/** When the comment was created */
createdAt: string;
/** Unique comment identifier */
id: string;
/** When the comment was last updated */
updatedAt: string;
}
export interface Error {
issues: Issue[];
layer: Layer;
}
export type ErrorResponseBody = Error;
export interface Issue {
code: string;
detail: string;
meta: Record<string, unknown>;
path: string[];
pointer: string;
}
export type Layer = 'contract' | 'domain' | 'http';
export interface OffsetPagination {
current: number;
items: number;
next?: null | number;
prev?: null | number;
total: number;
}
export type SortDirection = 'asc' | 'desc';
/** A task representing work to be completed */
export interface Task {
/** Whether the task has been archived */
archived: boolean | null;
/** User responsible for completing this task */
assignee?: User | null;
/** Discussion comments on this task */
comments?: Comment[];
/** Timestamp when the task was created */
createdAt: string;
/**
* Detailed description of what needs to be done
* @example "Add OAuth2 login support for Google and GitHub providers"
*/
description: null | string;
/**
* Target date for task completion
* @example "2024-02-01T00:00:00Z"
*/
dueDate: null | string;
/** Unique task identifier */
id: string;
/**
* Priority level for task ordering
* @example "high"
*/
priority: TaskPriority | null;
/**
* Current status of the task
* @example "pending"
*/
status: TaskStatus | null;
/**
* Short title describing the task
* @example "Implement user authentication"
*/
title: string;
/** Timestamp of last modification */
updatedAt: string;
}
export interface TaskArchiveSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
/** A task representing work to be completed */
export interface TaskCreatePayload {
/**
* Detailed description of what needs to be done
* @example "Add OAuth2 login support for Google and GitHub providers"
*/
description?: null | string;
/**
* Target date for task completion
* @example "2024-02-01T00:00:00Z"
*/
dueDate?: null | string;
/**
* Priority level for task ordering
* @example "high"
*/
priority?: TaskPriority | null;
/**
* Current status of the task
* @example "pending"
*/
status?: TaskStatus | null;
/**
* Short title describing the task
* @example "Implement user authentication"
*/
title: string;
}
export interface TaskCreateSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
export interface TaskFilter {
AND?: TaskFilter[];
NOT?: TaskFilter;
OR?: TaskFilter[];
priority?: TaskPriorityFilter;
status?: TaskStatusFilter;
}
export interface TaskInclude {
assignee?: boolean;
comments?: boolean;
}
export interface TaskIndexSuccessResponseBody {
meta?: Record<string, unknown>;
pagination: OffsetPagination;
tasks: Task[];
}
export interface TaskPage {
number?: number;
size?: number;
}
export type TaskPriority = 'critical' | 'high' | 'low' | 'medium';
export type TaskPriorityFilter = TaskPriority | { eq?: TaskPriority; in?: TaskPriority[] };
export interface TaskShowSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
export interface TaskSort {
createdAt?: SortDirection;
dueDate?: SortDirection;
updatedAt?: SortDirection;
}
export type TaskStatus = 'archived' | 'completed' | 'in_progress' | 'pending';
export type TaskStatusFilter = TaskStatus | { eq?: TaskStatus; in?: TaskStatus[] };
/** A task representing work to be completed */
export interface TaskUpdatePayload {
/**
* Detailed description of what needs to be done
* @example "Add OAuth2 login support for Google and GitHub providers"
*/
description?: null | string;
/**
* Target date for task completion
* @example "2024-02-01T00:00:00Z"
*/
dueDate?: null | string;
/**
* Priority level for task ordering
* @example "high"
*/
priority?: TaskPriority | null;
/**
* Current status of the task
* @example "pending"
*/
status?: TaskStatus | null;
/**
* Short title describing the task
* @example "Implement user authentication"
*/
title?: string;
}
export interface TaskUpdateSuccessResponseBody {
meta?: Record<string, unknown>;
task: Task;
}
export interface TasksArchiveRequest {
query: TasksArchiveRequestQuery;
}
export interface TasksArchiveRequestQuery {
include?: TaskInclude;
}
export interface TasksArchiveResponse {
body: TasksArchiveResponseBody;
}
export type TasksArchiveResponseBody = ErrorResponseBody | TaskArchiveSuccessResponseBody;
export interface TasksCreateRequest {
query: TasksCreateRequestQuery;
body: TasksCreateRequestBody;
}
export interface TasksCreateRequestBody {
task: TaskCreatePayload;
}
export interface TasksCreateRequestQuery {
include?: TaskInclude;
}
export interface TasksCreateResponse {
body: TasksCreateResponseBody;
}
export type TasksCreateResponseBody = ErrorResponseBody | TaskCreateSuccessResponseBody;
export interface TasksDestroyRequest {
query: TasksDestroyRequestQuery;
}
export interface TasksDestroyRequestQuery {
include?: TaskInclude;
}
export type TasksDestroyResponse = never;
export interface TasksIndexRequest {
query: TasksIndexRequestQuery;
}
export interface TasksIndexRequestQuery {
filter?: TaskFilter | TaskFilter[];
include?: TaskInclude;
page?: TaskPage;
sort?: TaskSort | TaskSort[];
}
export interface TasksIndexResponse {
body: TasksIndexResponseBody;
}
export type TasksIndexResponseBody = ErrorResponseBody | TaskIndexSuccessResponseBody;
export interface TasksShowRequest {
query: TasksShowRequestQuery;
}
export interface TasksShowRequestQuery {
include?: TaskInclude;
}
export interface TasksShowResponse {
body: TasksShowResponseBody;
}
export type TasksShowResponseBody = ErrorResponseBody | TaskShowSuccessResponseBody;
export interface TasksUpdateRequest {
query: TasksUpdateRequestQuery;
body: TasksUpdateRequestBody;
}
export interface TasksUpdateRequestBody {
task: TaskUpdatePayload;
}
export interface TasksUpdateRequestQuery {
include?: TaskInclude;
}
export interface TasksUpdateResponse {
body: TasksUpdateResponseBody;
}
export type TasksUpdateResponseBody = ErrorResponseBody | TaskUpdateSuccessResponseBody;
/** A user who can be assigned to tasks */
export interface User {
/**
* User's email address
* @example "jane@example.com"
*/
email: string;
/** Unique user identifier */
id: string;
/**
* User's display name
* @example "Jane Doe"
*/
name: string;
}OpenAPI
yml
---
openapi: 3.1.0
info:
contact:
email: support@example.com
name: API Support
description: API for managing tasks and projects
license:
name: MIT
url: https://opensource.org/licenses/MIT
title: Task Management API
version: 1.0.0
paths:
"/tasks":
get:
description: Returns a paginated list of tasks with optional filtering by status
and priority
operationId: listTasks
summary: List all tasks
tags:
- Tasks
- Core
parameters:
- in: query
name: filter
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/taskFilter"
- items:
"$ref": "#/components/schemas/taskFilter"
type: array
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
- in: query
name: page
required: false
schema:
"$ref": "#/components/schemas/taskPage"
- in: query
name: sort
required: false
schema:
oneOf:
- "$ref": "#/components/schemas/taskSort"
- items:
"$ref": "#/components/schemas/taskSort"
type: array
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/taskIndexSuccessResponseBody"
description: Successful response
post:
description: Creates a task and returns the created resource
operationId: createTask
summary: Create a new task
tags:
- Tasks
parameters:
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
requestBody:
content:
application/json:
schema:
properties:
task:
"$ref": "#/components/schemas/taskCreatePayload"
type: object
required:
- task
required: true
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/taskCreateSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
"/tasks/{id}":
get:
description: Returns a single task by ID
operationId: getTask
summary: Get task details
tags:
- Tasks
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/taskShowSuccessResponseBody"
description: Successful response
patch:
description: Updates an existing task
operationId: updateTask
summary: Update a task
tags:
- Tasks
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
requestBody:
content:
application/json:
schema:
properties:
task:
"$ref": "#/components/schemas/taskUpdatePayload"
type: object
required:
- task
required: true
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/taskUpdateSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
delete:
description: Permanently removes a task
operationId: deleteTask
summary: Delete a task
tags:
- Tasks
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
responses:
'204':
description: No content
"/tasks/{id}/archive":
patch:
deprecated: true
description: Marks a task as archived. Archived tasks are hidden from default
listings but can still be retrieved.
operationId: archiveTask
summary: Archive a task
tags:
- Tasks
- Lifecycle
parameters:
- in: path
name: id
required: true
schema:
type: string
- in: query
name: include
required: false
schema:
"$ref": "#/components/schemas/taskInclude"
responses:
'200':
content:
application/json:
schema:
"$ref": "#/components/schemas/taskArchiveSuccessResponseBody"
description: Successful response
'422':
description: Unprocessable Entity
content:
application/json:
schema:
"$ref": "#/components/schemas/errorResponseBody"
components:
schemas:
comment:
properties:
authorName:
type:
- string
- 'null'
description: Name of the person who wrote the comment
example: John Doe
body:
type: string
description: Comment content
example: This looks good, ready for review.
createdAt:
type: string
format: date-time
description: When the comment was created
id:
type: string
description: Unique comment identifier
updatedAt:
type: string
format: date-time
description: When the comment was last updated
type: object
description: A comment on a task
required:
- authorName
- body
- createdAt
- id
- updatedAt
error:
properties:
issues:
items:
"$ref": "#/components/schemas/issue"
type: array
layer:
enum:
- http
- contract
- domain
type: string
type: object
required:
- issues
- layer
errorResponseBody:
"$ref": "#/components/schemas/error"
issue:
properties:
code:
type: string
detail:
type: string
meta:
properties: {}
type: object
path:
items:
type: string
type: array
pointer:
type: string
type: object
required:
- code
- detail
- meta
- path
- pointer
offsetPagination:
properties:
current:
type: integer
items:
type: integer
next:
type:
- integer
- 'null'
prev:
type:
- integer
- 'null'
total:
type: integer
type: object
required:
- current
- items
- total
task:
properties:
archived:
type:
- boolean
- 'null'
description: Whether the task has been archived
deprecated: true
assignee:
oneOf:
- "$ref": "#/components/schemas/user"
- type: 'null'
comments:
items:
"$ref": "#/components/schemas/comment"
type: array
description: Discussion comments on this task
createdAt:
type: string
format: date-time
description: Timestamp when the task was created
description:
type:
- string
- 'null'
description: Detailed description of what needs to be done
example: Add OAuth2 login support for Google and GitHub providers
dueDate:
type:
- string
- 'null'
format: date-time
description: Target date for task completion
example: '2024-02-01T00:00:00Z'
id:
type: string
description: Unique task identifier
priority:
enum:
- low
- medium
- high
- critical
type:
- string
- 'null'
status:
enum:
- pending
- in_progress
- completed
- archived
type:
- string
- 'null'
title:
type: string
description: Short title describing the task
example: Implement user authentication
updatedAt:
type: string
format: date-time
description: Timestamp of last modification
type: object
description: A task representing work to be completed
required:
- archived
- createdAt
- description
- dueDate
- id
- priority
- status
- title
- updatedAt
taskArchiveSuccessResponseBody:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
taskCreatePayload:
properties:
description:
type:
- string
- 'null'
description: Detailed description of what needs to be done
example: Add OAuth2 login support for Google and GitHub providers
dueDate:
type:
- string
- 'null'
format: date-time
description: Target date for task completion
example: '2024-02-01T00:00:00Z'
priority:
enum:
- low
- medium
- high
- critical
type:
- string
- 'null'
status:
enum:
- pending
- in_progress
- completed
- archived
type:
- string
- 'null'
title:
type: string
description: Short title describing the task
example: Implement user authentication
type: object
description: A task representing work to be completed
required:
- title
taskCreateSuccessResponseBody:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
taskFilter:
properties:
AND:
items:
"$ref": "#/components/schemas/taskFilter"
type: array
NOT:
"$ref": "#/components/schemas/taskFilter"
OR:
items:
"$ref": "#/components/schemas/taskFilter"
type: array
priority:
"$ref": "#/components/schemas/taskPriorityFilter"
status:
"$ref": "#/components/schemas/taskStatusFilter"
type: object
taskInclude:
properties:
assignee:
type: boolean
comments:
type: boolean
type: object
taskIndexSuccessResponseBody:
properties:
pagination:
"$ref": "#/components/schemas/offsetPagination"
meta:
properties: {}
type: object
tasks:
items:
"$ref": "#/components/schemas/task"
type: array
type: object
required:
- pagination
- tasks
taskPage:
properties:
number:
type: integer
minimum: 1
size:
type: integer
minimum: 1
maximum: 100
type: object
taskPriorityFilter:
oneOf:
- enum:
- low
- medium
- high
- critical
type: string
- properties:
eq:
enum:
- low
- medium
- high
- critical
type: string
in:
items:
enum:
- low
- medium
- high
- critical
type: string
type: array
type: object
required:
- eq
- in
taskShowSuccessResponseBody:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
taskSort:
properties:
createdAt:
enum:
- asc
- desc
type: string
dueDate:
enum:
- asc
- desc
type: string
updatedAt:
enum:
- asc
- desc
type: string
type: object
taskStatusFilter:
oneOf:
- enum:
- pending
- in_progress
- completed
- archived
type: string
- properties:
eq:
enum:
- pending
- in_progress
- completed
- archived
type: string
in:
items:
enum:
- pending
- in_progress
- completed
- archived
type: string
type: array
type: object
required:
- eq
- in
taskUpdatePayload:
properties:
description:
type:
- string
- 'null'
description: Detailed description of what needs to be done
example: Add OAuth2 login support for Google and GitHub providers
dueDate:
type:
- string
- 'null'
format: date-time
description: Target date for task completion
example: '2024-02-01T00:00:00Z'
priority:
enum:
- low
- medium
- high
- critical
type:
- string
- 'null'
status:
enum:
- pending
- in_progress
- completed
- archived
type:
- string
- 'null'
title:
type: string
description: Short title describing the task
example: Implement user authentication
type: object
description: A task representing work to be completed
taskUpdateSuccessResponseBody:
properties:
meta:
properties: {}
type: object
task:
"$ref": "#/components/schemas/task"
type: object
required:
- task
user:
properties:
email:
type: string
description: User's email address
example: jane@example.com
format: email
id:
type: string
description: Unique user identifier
name:
type: string
description: User's display name
example: Jane Doe
type: object
description: A user who can be assigned to tasks
required:
- email
- id
- name