Skip to main content

A Flake8 plugin to enforce OpenAPI docstrings in Flask routes

Project description

flake8-flask-openapi-docstring

This Flake8 plugin will check if your Flask route's docstrings are valid OpenAPI spec.

Libraries like APISpec can generate OpenAPI spec from your Flask routes and docstrings and it's important to have present and in the correct format.

for example, this routes:

@app.route("/hello", methods=["GET"])
def hello():
    return "Hello World!"

will raise an error witht his plugin because not only the docstring is missing but also the OpenAPI spec is missing as well.

However these route:

@app.route("/hello", methods=["GET"])
def hello():
    """
    Returns a greeting

    ---
    get:
        responses:
            200:
    """
    return "Hello World!"

will not raise any error because the docstring is present and the OpenAPI spec is present as well.

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

flake8_flask_openapi_docstring-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file flake8_flask_openapi_docstring-0.1.2.tar.gz.

File metadata

File hashes

Hashes for flake8_flask_openapi_docstring-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f2c8c68271c48a56905956abd18a99b967bd5e88431252ad0251bbeda28483e6
MD5 16393016cda6c430f0dc293203384447
BLAKE2b-256 8eac00d35e5e3f21608a5bc7e32b982fb7a9153e9045137b55f14eaed52f9514

See more details on using hashes here.

File details

Details for the file flake8_flask_openapi_docstring-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_flask_openapi_docstring-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1899695080ec0f4785b5794acc92de849d8ce462d885ccb111b8cb54aa069e5e
MD5 733d98e5dd76d1469f217d39b5b51043
BLAKE2b-256 52c611dd2a2b07e5f253ad85920032f9acd68c8279b960be60bf26dedef0e7ea

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