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 hashes)

Uploaded Source

Built Distribution

Supported by

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