A library to generate OpenAPI specs from Python FastAPI projects.
Project description
discovery-scs
FastAPI-Ecommerce-API with OpenAPI Spec Generation
This repository contains the FastAPI-based E-commerce API, extended with a script to generate an OpenAPI specification using the openapi-specgen library.
Features
- Listens for GitHub webhook events for pull requests.
- Dynamically clones or updates the repository to a specified folder.
- Runs a pipeline (
main.py) to analyze the repository and generate an OpenAPI spec.
Project Structure
discovery-scs/
├── main.py # Pipeline script for OpenAPI generation
├── webhook_listener.py # Webhook Listener for handling PR events
├── repo_to_scan/ # Folder where repositories are cloned
├── openapi_spec.json # Generated OpenAPI specification
└── README.md # Setup guide and documentation
Setup Instructions
1. Prerequisites
- Python: Installed with Conda or a similar package manager.
- Git: Installed and available in the system PATH.
- ngrok: For local webhook testing.
- GitHub Repository Access: To set up webhooks.
2. Clone This Repository
Clone this repository and navigate to the project directory:
# Clone the repository
git clone https://github.com/tope-ai/discovery-scs.git
# Navigate to the project directory
cd discovery-scs
pip install my_openapi_lib
- Update the folder_to_scan variable in main.py with your project path:
folder_to_scan = r"C:\your\path\to\discovery-scs\FastAPI-Ecommerce-API-main"
Generate OpenAPI Spec
Run the main script:
python main.py
The script will:
Scan the FastAPI-Ecommerce-API folder Find important Python files Generate OpenAPI specification Save it as openapi_spec.json Project Structure spec_gen_19.1/ └── discovery-scs/ ├── FastAPI-Ecommerce-API-main/ ├── openapi-specgen-master/ ├── main.py └── README.md
Validate the Spec
- Open the
openapi_ecommerce_specgen.jsonfile in Swagger Editor to validate and explore the API.
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 my_openapi_lib-0.1.0.tar.gz.
File metadata
- Download URL: my_openapi_lib-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f76b0168b0a81475667a1dd7fea0d24fb64211177e8e53d19c264a711b0249c3
|
|
| MD5 |
88d47becdb359f6b526aa218271a8e13
|
|
| BLAKE2b-256 |
84bbb9047505b5bca382c6d2932c8be8df4d231ca92b982ecc9b4e156dfd3695
|
File details
Details for the file my_openapi_lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: my_openapi_lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27a9d7a1dfd22d93b9055bd73bc6e46f59e697cbfb9ced73554ff6317b1ea27b
|
|
| MD5 |
f522f18efbad09707dca76f887f585fb
|
|
| BLAKE2b-256 |
807fc909d727cc9e6f17ccf98b3c1950650b71614f4a4eb0f4c2c3189f52af25
|