Skip to main content

Generate REST API and OpenAPI documentation for your Flask project.

Project description

Generate REST API and OpenAPI documentation for your Flask project.

test pypi pypistats pypi versions

Flask OpenAPI3 is a web API framework based on Flask. It uses Pydantic to verify data and automatic generation of interaction documentation: Swagger UI, ReDoc and RapiDoc.

The key features are:

Requirements

Python 3.7+

flask-openapi3 be dependent on the following libraries:

Installation

pip install -U flask-openapi3

A Simple Example

Here's a simple example, further go to the Example.

from pydantic import BaseModel

from flask_openapi3 import Info, Tag
from flask_openapi3 import OpenAPI

info = Info(title='book API', version='1.0.0')
app = OpenAPI(__name__, info=info)

book_tag = Tag(name='book', description='Some Book')


class BookQuery(BaseModel):
    age: int
    author: str


@app.get('/book', tags=[book_tag])
def get_book(query: BookQuery):
    """get books
    get all books
    """
    return {
        "code": 0,
        "message": "ok",
        "data": [
            {"bid": 1, "age": query.age, "author": query.author},
            {"bid": 2, "age": query.age, "author": query.author}
        ]
    }


if __name__ == '__main__':
    app.run(debug=True)

API Document

Run the simple example, and go to http://127.0.0.1:5000/openapi.

You will see the documentation: Swagger UI, Redoc and RapiDoc.

openapi openapi-swagger openapi-redoc openapi-RapiDoc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-openapi3-1.1.3.tar.gz (939.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_openapi3-1.1.3-py3-none-any.whl (946.5 kB view details)

Uploaded Python 3

File details

Details for the file flask-openapi3-1.1.3.tar.gz.

File metadata

  • Download URL: flask-openapi3-1.1.3.tar.gz
  • Upload date:
  • Size: 939.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for flask-openapi3-1.1.3.tar.gz
Algorithm Hash digest
SHA256 c7294b63488d486dd24c7ddc1f0416a8889dab96d01e863aa52a05729b7eb5c6
MD5 070c235a047fdad4e44a418f3a624497
BLAKE2b-256 fa354d014156d00c6673d8af4faf0a1d5a143e218b6313adfa7bafca4e567e64

See more details on using hashes here.

File details

Details for the file flask_openapi3-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: flask_openapi3-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 946.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for flask_openapi3-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7813b1c3dcff0718d11ec43a04eaab3e271b79aac072e0f5af34571bb2bb96d9
MD5 1641df7383d1e0ca8f639a919ec117ab
BLAKE2b-256 3be00760750d31f83ac1f9e10c4a01fc768daa8d444446dbf83c762c5c396782

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page