Enhanced Swagger UI for FastAPI with tag-based filtering and download links
Project description
FastAPI Swagger Splitter
Enhanced Swagger UI for FastAPI applications with tag-based filtering, download links, and search functionality.
Features
- 🎨 Custom Styled UI - Beautiful, modern Swagger UI with custom CSS
- 📥 Download Links - Download complete or tag-specific OpenAPI JSON schemas
- 🔍 Tag Search - Search and filter tags in real-time
- 🏷️ Tag-based Filtering - Generate OpenAPI schemas filtered by specific tags
- 🚀 Easy Integration - Simple setup with just one function call
Installation
pip install fastapi-swagger-splitter
Quick Start
from fastapi import FastAPI
from fastapi_swagger_splitter import setup_swagger_splitter
# Create your FastAPI app
app = FastAPI(
title="My API",
description="API documentation",
version="1.0.0",
docs_url=None, # Disable default docs - we'll use custom one
openapi_url="/openapi.json",
)
# Setup custom Swagger UI
setup_swagger_splitter(app, swagger_path="/docs")
@app.get("/")
async def root():
return {"message": "Hello World"}
That's it! Now visit http://localhost:8000/docs to see your enhanced Swagger UI.
Features in Detail
Download Complete OpenAPI JSON
Click the "Complete OpenAPI JSON" link to download the full OpenAPI schema for your API.
Download Tag-Specific OpenAPI JSON
Each tag in your API gets its own download link. Click any tag name to download an OpenAPI JSON file containing only endpoints and schemas related to that tag.
Search Tags
Use the search input to quickly find tags by name. The search is case-insensitive and filters tags in real-time as you type.
API Endpoints
The package automatically creates these endpoints:
GET /docs- Custom Swagger UI (or your custom path)GET /docs/json- Complete OpenAPI JSON schemaGET /docs/json/{tag}- Tag-specific OpenAPI JSON schemaGET /docs/tags- List of all available tags
Customization
Custom Swagger Path
You can customize the Swagger UI path:
setup_swagger_splitter(app, swagger_path="/api-docs")
Now your Swagger UI will be available at /api-docs instead of /docs.
Requirements
- Python 3.8+
- FastAPI 0.68.0+
- Starlette 0.14.0+
Development
# Clone the repository
git clone https://github.com/yourusername/fastapi-swagger-splitter.git
cd fastapi-swagger-splitter
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Changelog
0.1.0 (2024-01-XX)
- Initial release
- Custom Swagger UI with download links
- Tag-based filtering
- Search functionality
fastapi-swagger-splitter
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_swagger_splitter-0.1.1.tar.gz.
File metadata
- Download URL: fastapi_swagger_splitter-0.1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a720f98fa4d2548014bd3271ea5c4cb0c579a91c0973e0251b593a66aeb43892
|
|
| MD5 |
445c2ccd07b96576162b9d419da8dad4
|
|
| BLAKE2b-256 |
d3f5c2fb0fc93f3ec574ac872da5278a9dd76378d2815f026ac48595d81e204c
|
File details
Details for the file fastapi_swagger_splitter-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_swagger_splitter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
630d6a79151b144b335973dd6ffc6e50cd8db8368bfd31e6783d1c22712ecaac
|
|
| MD5 |
30ce887cba0625b24704f232a7870a32
|
|
| BLAKE2b-256 |
f93a033b8c356793d05ac96081848576da88219146b7090b2b6bb62f54c7e4e1
|