Skip to content

Commit 3f774a5

Browse files
committed
feat: add Swagger/OpenAPI documentation with interactive API explorer
- Add flasgger dependency for Swagger UI - Document all 13 API endpoints with detailed schemas - Include request/response examples and parameter descriptions - Add interactive API documentation at /apidocs - Update README with API documentation section - Bump version to 1.0.1
1 parent 1bf7cc7 commit 3f774a5

File tree

4 files changed

+792
-26
lines changed

4 files changed

+792
-26
lines changed

README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ pip install -r requirements.txt
114114
python app.py
115115
```
116116

117-
Visit `http://localhost:5000`
117+
Visit:
118+
- **Web UI:** `http://localhost:5000`
119+
- **API Documentation:** `http://localhost:5000/apidocs`
118120

119121
## Running with Docker
120122

@@ -198,16 +200,36 @@ docker build -t kea-gui .
198200
docker run -d -p 5000:5000 -v $(pwd)/config.yaml:/app/config/config.yaml:ro kea-gui
199201
```
200202

201-
## API Endpoints
203+
## API Documentation
202204

203-
- `GET /api/leases` - Fetch all DHCPv4 leases
204-
- `POST /api/promote` - Promote a lease to reservation
205-
- `GET /api/reservations` - List current reservations
205+
### Interactive API Explorer
206+
207+
This application includes **Swagger/OpenAPI documentation** with an interactive API explorer:
208+
209+
**📚 Access the API documentation at: `http://localhost:5000/apidocs`**
210+
211+
The Swagger UI provides:
212+
- Complete API reference with request/response schemas
213+
- Interactive "Try it out" functionality to test endpoints directly
214+
- Example requests and responses for each endpoint
215+
- Parameter descriptions and validation rules
216+
217+
### API Endpoints Summary
218+
219+
- `GET /api/health` - Health check and KEA connectivity status
220+
- `GET /api/leases` - Fetch all DHCPv4 leases (optional: filter by subnet)
221+
- `GET /api/reservations` - List current reservations (optional: filter by subnet)
206222
- `POST /api/reservations` - Create a new reservation
223+
- `POST /api/promote` - Promote a lease to permanent reservation
207224
- `DELETE /api/reservation/<ip>` - Delete a reservation
208225
- `GET /api/reservations/export` - Export all reservations to JSON file
209226
- `POST /api/reservations/import` - Import reservations from JSON file
210-
- `GET /api/health` - Health check
227+
- `GET /api/subnets` - Get configured DHCP subnets
228+
- `POST /api/validate-ip` - Validate IP address against subnet
229+
- `GET /api/config` - Get current configuration (sanitized)
230+
- `POST /api/config` - Save configuration to file
231+
232+
For detailed documentation including request/response schemas, visit `/apidocs` when the application is running.
211233

212234
## Usage
213235

0 commit comments

Comments
 (0)