Skip to content

Commit e07c889

Browse files
author
Will Flores
committed
feat: Add FastAPI API documentation with XLS-80 endpoint descriptions
- Add api/docs.py with comprehensive API description and tag metadata - Integrate OpenAPI docs at /docs and /redoc endpoints - Configure endpoint tags for Public, Permissioned Domains, Admin, Monitoring - Fix multi-line import syntax in main.py - Remove htmlcov from tracking, disable HTML coverage reports - Clean repository language distribution (100% Python)
1 parent 6e298fd commit e07c889

File tree

4 files changed

+72
-83
lines changed

4 files changed

+72
-83
lines changed

api/docs.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
"""
2+
API Documentation Configuration
3+
"""
4+
5+
DESCRIPTION = """
6+
# Ward Protocol API
7+
8+
**Ward Protocol** is the first institutional insurance layer for XRP Ledger DeFi lending,
9+
featuring XLS-80 Permissioned Domains for compliance-ready capital deployment.
10+
11+
## Features
12+
13+
### Permissioned Domains (XLS-80)
14+
- Create institutional compliance domains
15+
- Manage credential-based access control
16+
- Verify domain membership
17+
18+
### XLS-70 Credentials
19+
- Issue and verify credentials
20+
- Cached verification for performance
21+
- Support for multiple credential types
22+
23+
### Insurance Pools
24+
- Monitor vault health
25+
- Automated coverage deployment
26+
- Real-time risk assessment
27+
28+
## Authentication
29+
30+
All endpoints require API key authentication via `X-API-Key` header.
31+
32+
**Example:**
33+
```bash
34+
curl -H "X-API-Key: your_key_here" https://api.wardprotocol.org/domains
35+
```
36+
37+
## Rate Limits
38+
39+
- Public endpoints: 100 requests/minute
40+
- Authenticated endpoints: 1000 requests/minute
41+
- Admin endpoints: Unlimited
42+
43+
## Support
44+
45+
- Documentation: https://github.com/wflores9/ward-protocol
46+
- Issues: https://github.com/wflores9/ward-protocol/issues
47+
"""
48+
49+
TAGS_METADATA = [
50+
{
51+
"name": "Public",
52+
"description": "Public endpoints - no authentication required"
53+
},
54+
{
55+
"name": "Permissioned Domains",
56+
"description": "XLS-80 Permissioned Domains management. Control institutional access via credentials."
57+
},
58+
{
59+
"name": "Admin",
60+
"description": "Administrative endpoints - requires admin API key with full permissions"
61+
},
62+
{
63+
"name": "Monitoring",
64+
"description": "Health checks and system monitoring"
65+
}
66+
]

main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from fastapi import FastAPI, HTTPException, Depends, Request
2+
from api.docs import DESCRIPTION, TAGS_METADATA
23
from fastapi.middleware.cors import CORSMiddleware
34
from slowapi.middleware import SlowAPIMiddleware
45
from slowapi.errors import RateLimitExceeded
@@ -41,10 +42,11 @@
4142

4243
app = FastAPI(
4344
title="Ward Protocol API",
44-
description="Institutional Insurance for XRPL DeFi Lending - Enterprise Grade",
45-
version="1.0.0",
46-
docs_url="/docs" if os.getenv("DEBUG", "false").lower() == "true" else None,
47-
redoc_url="/redoc" if os.getenv("DEBUG", "false").lower() == "true" else None
45+
description=DESCRIPTION,
46+
version="0.1.0",
47+
openapi_tags=TAGS_METADATA,
48+
docs_url="/docs",
49+
redoc_url="/redoc"
4850
)
4951

5052
app.add_middleware(SecurityHeadersMiddleware)

main.py.backup

Lines changed: 0 additions & 78 deletions
This file was deleted.

pytest.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ addopts =
99
--cov=core
1010
--cov=main
1111
--cov-report=term-missing
12-
--cov-report=html
1312
--strict-markers
1413
markers =
1514
unit: Unit tests

0 commit comments

Comments
 (0)