File size: 1,540 Bytes
fcacf10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""
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("===================================")