""" Verify the OpenAPI schema generates correctly. This confirms all routers, schemas, and dependencies resolve. """ from app.main import app from fastapi.testclient import TestClient client = TestClient(app) # Get OpenAPI schema response = client.get("/openapi.json") assert response.status_code == 200, f"OpenAPI schema returned {response.status_code}" schema = response.json() paths = list(schema.get("paths", {}).keys()) print(f"Total API paths: {len(paths)}") print() # Verify all expected endpoints exist expected_endpoints = [ "/auth/signup", "/auth/login", "/auth/me", "/documents", "/documents/upload", "/workspaces", "/proposals", "/proposals/{proposal_id}/approve", "/proposals/{proposal_id}/reject", "/workflows", "/workflows/{workflow_id}", "/workflows/by-document-version/{document_version_id}", "/rules", "/rules/{rule_id}", "/rules/{rule_id}/enable", "/rules/{rule_id}/disable", "/knowledge", "/knowledge/search", "/knowledge/{item_id}", "/activity", "/dashboard/stats", ] missing = [] for ep in expected_endpoints: if ep not in paths: missing.append(ep) else: print(f" {ep}: OK") if missing: print(f"\nMISSING ENDPOINTS: {missing}") assert False, f"Missing endpoints: {missing}" else: print(f"\nAll {len(expected_endpoints)} expected endpoints registered.") print("\n===================================") print("OPENAPI SCHEMA VERIFICATION PASSED") print("===================================")