Enhance Swagger documentation and web UI navigation
Enhanced API Swagger documentation and improved web interface navigation with dropdown menus and better organization. API Changes (api/main.py): ========================== - Enhanced FastAPI app description with architecture diagram - Added detailed rate limiting information - Added server configurations (production + local) - Added contact and license information - Enhanced all endpoint descriptions with: * Detailed parameter descriptions * Response descriptions * Error responses * Rate limit information * Usage examples - Added Field descriptions to all Pydantic models - Added schema examples for better Swagger UI - Enhanced LLM endpoints with AI rate limiting details - Added status codes (201, 404, 429, 500) to endpoints - Improved startup message with docs URLs Swagger UI Improvements: - Better organized endpoint groups (Root, Health, Items, Users, LLM) - Detailed request/response schemas - Interactive examples for all endpoints - Rate limiting documentation - Architecture overview in description Web Changes (web/templates/base.html): ====================================== - Added dropdown menu for API documentation with: * API Root (/) * Swagger UI (/docs) * ReDoc (/redoc) * OpenAPI JSON (/openapi.json) - Added emoji icons to all menu items for better UX - Added tooltips (title attributes) to all links - Renamed "API Config" to "Settings" for clarity - Added CSS for dropdown menu functionality - Improved footer text - Better visual hierarchy with icons Navigation Menu: - 🏠 Home - 📦 Items - 👥 Users - 🤖 LLM Chat - 📚 API Docs (dropdown with 4 options) - ⚙️ Settings All endpoints now have comprehensive documentation visible in Swagger UI at https://commandware.it/api/docs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,52 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{% block title %}API Demo{% endblock %}</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css" />
|
||||
<style>
|
||||
/* Dropdown Menu Styles */
|
||||
.nav-menu {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #2c3e50;
|
||||
min-width: 200px;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.3);
|
||||
z-index: 1000;
|
||||
border-radius: 4px;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.dropdown-content a {
|
||||
color: white;
|
||||
padding: 12px 16px;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.dropdown-content a:hover {
|
||||
background-color: #34495e;
|
||||
}
|
||||
|
||||
.dropdown:hover .dropdown-content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropbtn {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar">
|
||||
@@ -13,15 +59,21 @@
|
||||
<h2>🚀 API7EE Demo</h2>
|
||||
</div>
|
||||
<ul class="nav-menu">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/items">Items</a></li>
|
||||
<li><a href="/users">Users</a></li>
|
||||
<li><a href="/llm">LLM Chat</a></li>
|
||||
<li><a href="/api/docs" target="_blank">API Docs</a></li>
|
||||
<li><a href="/" title="Home page">🏠 Home</a></li>
|
||||
<li><a href="/items" title="Manage items inventory">📦 Items</a></li>
|
||||
<li><a href="/users" title="Manage users">👥 Users</a></li>
|
||||
<li><a href="/llm" title="AI-powered chat">🤖 LLM Chat</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropbtn" title="API Documentation">📚 API Docs ▾</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="/api/" target="_blank" title="API root endpoint">API Root</a>
|
||||
<a href="/api/docs" target="_blank" title="Swagger UI documentation">Swagger UI</a>
|
||||
<a href="/api/redoc" target="_blank" title="ReDoc documentation">ReDoc</a>
|
||||
<a href="/api/openapi.json" target="_blank" title="OpenAPI JSON schema">OpenAPI JSON</a>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" onclick="openApiConfig(event)"
|
||||
>⚙️ API Config</a
|
||||
>
|
||||
<a href="#" onclick="openApiConfig(event)" title="Configure API settings">⚙️ Settings</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -85,7 +137,7 @@
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<p>© 2025 API7EE Demo | Powered by FastAPI & API7</p>
|
||||
<p>© 2025 API7EE Demo | Powered by FastAPI & API7 Enterprise Gateway</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user