api-doc-gen
Auto-generate OpenAPI 3.0 documentation from Python API source code.
A CLI tool that scans Python source files (Flask, FastAPI, Django REST) for API route definitions and generates complete OpenAPI 3.0 specifications with documentation quality validation.
Features
- Multi-Framework Scanning — Detects Flask, FastAPI, and Django REST Framework routes
- OpenAPI 3.0 Generation — Produces valid OpenAPI specs in YAML or JSON
- Documentation Quality Validation — 10 built-in rules (DOC-001 to DOC-010)
- Coverage Analysis — Track documentation completeness by endpoint and method
- Rich Terminal Output — Color-coded tables with quality grades
- HTML Report Generation — Shareable documentation reports
- CI/CD Integration —
--fail-onflag for pipeline gates
Installation
pip install -e .
Quick Start
# Generate demo project
api-doc-gen demo
# Scan for endpoints
api-doc-gen scan demo-api/
# Generate OpenAPI spec
api-doc-gen generate demo-api/ -o openapi.yaml
# Validate documentation quality
api-doc-gen validate demo-api/
# Check coverage
api-doc-gen coverage demo-api/
# Generate HTML report
api-doc-gen report demo-api/ -o docs.html
# List validation rules
api-doc-gen rules
Validation Rules
| Rule | Severity | Description |
|---|---|---|
| DOC-001 | ERROR | Endpoint missing summary |
| DOC-002 | WARNING | Endpoint missing description |
| DOC-003 | ERROR | No response definitions |
| DOC-004 | WARNING | Parameter missing description |
| DOC-005 | INFO | No tags assigned |
| DOC-006 | WARNING | Missing operation ID |
| DOC-007 | ERROR | POST/PUT/PATCH without request body |
| DOC-008 | ERROR | Duplicate operation ID |
| DOC-009 | ERROR | Path parameter not documented |
| DOC-010 | WARNING | Inconsistent path naming (mixed case) |
CI/CD Integration
- name: API Doc Validation
run: |
api-doc-gen validate src/ --fail-on error
Testing
python -m pytest tests/ -v
License
MIT
Metadata
Release files for api-doc-gen 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| api_doc_gen-1.0.0.tar.gz | 18.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| api_doc_gen-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.8 kB
Release files / api_doc_gen-1.0.0.tar.gz
| Download URL | api_doc_gen-1.0.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53cc4a43b30bfb705f05f7eadd64ad6d4ed9ce63db9a9c5a4e3bb8ac603c5347
|
|
BLAKE2b-256 checksum How to use checksums |
435cded77e128a6f0d2b14fccea94c7d06d615f756d4228c5326aba26c7b1cd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / api_doc_gen-1.0.0-py3-none-any.whl
| Download URL | api_doc_gen-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e5a44f28f64f1ea968656e33fbc38301ff11ea3ecf363463cd7fafc26b5896c
|
|
BLAKE2b-256 checksum How to use checksums |
c6dfbacf700bc4ae58be057223868f0af8a8ed24bce9a840b93e96a0a7cab618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Security for api-doc-gen 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.