Implement comprehensive API documentation system
✨ Features: - Comprehensive Pydantic response models with examples - Enhanced FastAPI configuration with rich OpenAPI metadata - Centralized error handling with standardized error codes - Professional Swagger UI styling and branding - Health check endpoints with detailed component status - Type-safe request/response models for all endpoints 📊 Coverage: - Agent Management API fully documented - Standardized error responses across all endpoints - Interactive API documentation with try-it-now functionality - Custom OpenAPI schema with authentication schemes 🛠️ Technical Improvements: - Created app/models/responses.py with comprehensive models - Added app/core/error_handlers.py for centralized error handling - Enhanced app/api/agents.py with detailed documentation - Custom documentation configuration in app/docs_config.py - Global exception handlers for consistent error responses 🌐 Access Points: - Swagger UI: /docs - ReDoc: /redoc - OpenAPI JSON: /openapi.json This establishes professional-grade API documentation that matches Hive's technical excellence and provides developers with comprehensive, interactive documentation for efficient integration. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from typing import Dict, Any, List
|
||||
from app.core.auth import get_current_user
|
||||
from ..core.auth_deps import get_current_user_context
|
||||
from app.services.project_service import ProjectService
|
||||
|
||||
router = APIRouter()
|
||||
project_service = ProjectService()
|
||||
|
||||
@router.get("/projects")
|
||||
async def get_projects(current_user: dict = Depends(get_current_user)) -> List[Dict[str, Any]]:
|
||||
async def get_projects(current_user: Dict[str, Any] = Depends(get_current_user_context)) -> List[Dict[str, Any]]:
|
||||
"""Get all projects from the local filesystem."""
|
||||
try:
|
||||
return project_service.get_all_projects()
|
||||
@@ -15,7 +15,7 @@ async def get_projects(current_user: dict = Depends(get_current_user)) -> List[D
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
@router.get("/projects/{project_id}")
|
||||
async def get_project(project_id: str, current_user: dict = Depends(get_current_user)) -> Dict[str, Any]:
|
||||
async def get_project(project_id: str, current_user: Dict[str, Any] = Depends(get_current_user_context)) -> Dict[str, Any]:
|
||||
"""Get a specific project by ID."""
|
||||
try:
|
||||
project = project_service.get_project_by_id(project_id)
|
||||
@@ -26,7 +26,7 @@ async def get_project(project_id: str, current_user: dict = Depends(get_current_
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
@router.get("/projects/{project_id}/metrics")
|
||||
async def get_project_metrics(project_id: str, current_user: dict = Depends(get_current_user)) -> Dict[str, Any]:
|
||||
async def get_project_metrics(project_id: str, current_user: Dict[str, Any] = Depends(get_current_user_context)) -> Dict[str, Any]:
|
||||
"""Get detailed metrics for a project."""
|
||||
try:
|
||||
metrics = project_service.get_project_metrics(project_id)
|
||||
@@ -37,7 +37,7 @@ async def get_project_metrics(project_id: str, current_user: dict = Depends(get_
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
@router.get("/projects/{project_id}/tasks")
|
||||
async def get_project_tasks(project_id: str, current_user: dict = Depends(get_current_user)) -> List[Dict[str, Any]]:
|
||||
async def get_project_tasks(project_id: str, current_user: Dict[str, Any] = Depends(get_current_user_context)) -> List[Dict[str, Any]]:
|
||||
"""Get tasks for a project (from GitHub issues and TODOS.md)."""
|
||||
try:
|
||||
return project_service.get_project_tasks(project_id)
|
||||
|
||||
Reference in New Issue
Block a user