https://github.com/wael34218/python_openapi_generator
This library facilitates creating OpenAPI (Swagger) document for Python projects.
https://github.com/wael34218/python_openapi_generator
Last synced: 4 months ago
JSON representation
This library facilitates creating OpenAPI (Swagger) document for Python projects.
- Host: GitHub
- URL: https://github.com/wael34218/python_openapi_generator
- Owner: wael34218
- License: mit
- Created: 2019-03-02T13:41:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-04T17:46:17.000Z (over 4 years ago)
- Last Synced: 2024-03-15T01:54:21.109Z (about 1 year ago)
- Language: Python
- Size: 195 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- jimsghstars - wael34218/python_openapi_generator - This library facilitates creating OpenAPI (Swagger) document for Python projects. (Python)
README
# Python OpenAPI (Swagger) Generator
This library facilitates creating OpenAPI (Swagger) document for Python projects.I worked for a long time in building APIs and services, and I can tell you that one thing I got sick of hearing was "Why your APIs are not documented?".
I searched long and hard for a library that generates documentation without me going back and forth editing yaml/json/markdown files ... its enough that I worry about writting unit and integration tests.
After long search I found 0 libraries that does that.
I was wondering why nobody has yet exploited this gap in a very lucrative market, wonder no longer. Help is at hand.## Installation
```
pip install openapi-generator
```## Generate your API using simple script
```
from openapi_generator import OpenapiGenerator
import requests# Step 1: Create an instance of the generator
gen = OpenapiGenerator("Title", "This is a testing description", "v0.0.1", server="https://swapi.co/")# Step 2: Add all responses
response = requests.get("https://swapi.co/api/planets/", params={"page": 2})
gen.add_response(response, description="Retrieving planets")response = requests.get("https://swapi.co/api/people/", params={"page": 3}, description="Retrieving people")
gen.add_response(response, description="Retrieving people")# Step 3:Export
gen.export("example.yml", extension="yaml")
# Also can set the extension to `json`# Step 4: Profit
```