Skip to content

[API] Add API Versioning #60

@fentz26

Description

@fentz26

Problem

No API versioning exists. This causes:

  • Breaking changes affect all clients
  • No deprecation path
  • Difficult upgrade experience

Current State

GET /tasks
POST /tasks/{id}/run

Proposed Solution

GET /v1/tasks
POST /v1/tasks/{id}/run

Implementation

func SetupRoutes(mux *http.ServeMux) {
    // API v1
    v1 := http.NewServeMux()
    v1.HandleFunc("/tasks", handleTasks)
    v1.HandleFunc("/tasks/{id}", handleTask)
    // ...
    
    mux.Handle("/v1/", http.StripPrefix("/v1", v1))
    
    // Future: API v2
    // mux.Handle("/v2/", http.StripPrefix("/v2", v2))
}

Acceptance Criteria

  • All endpoints prefixed with /v1/
  • Old endpoints redirect with deprecation warning
  • API version in response headers
  • Documentation includes version
  • Migration guide for existing clients

Versioning Policy

Change Type Version Impact
New endpoint Minor (1.x)
New optional field Minor (1.x)
Breaking change Major (2.0)
Bug fix Patch (1.0.x)

References

  • Evaluation Report Section: 1.1 API Design Quality

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions