Skip to main content

Flask-Pydantic-Docs

Installation

python3 -m pip install Flask-Pydantic-Docs

Usage

Example

# necessary imports

app = Flask(__name___)
openapi = OpenAPI()

access_denied = APIError(code=403, msg="Access Denied")

@app.route("/post", methods=["POST"])
@openapi_docs(response=ResponseModel, tags=["demo"], exceptions=[access_denied])
@validate()
def post(body: BodyModel, query: QueryModel):
    return ResponseModel(
        id=id_,
        age=query.age,
        name=body.name,
        nickname=body.nickname,
    )
...

openapi.register(app)

NOTE:

  • Since the openapi_docs decorator is to register the schemas based on the models used by the view function, so the models have to be put in the view function arguments with annotations as shown in the above example. Otherwise, the schemas cannot be captured.

  • The statement openapi.register needs to be run after all view functions or register_blueprint.

Add Auth Security Schemes

# necessary imports, app and model definition

openapi = OpenAPI(
    extra_props={
        "components": {
            "securitySchemes": {
                "bearerAuth": {
                    "type": "http",
                    "scheme": "bearer",
                    "bearerFormat": "JWT",
                }
            }
        },
        "security": [{"bearerAuth": []}]
    },
)

...

openapi.register(app)

Metadata

Release files for Flask-Pydantic-Docs 0.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Pydantic-Docs 0.0.17
File Size Uploaded Provenance Actions
Flask-Pydantic-Docs-0.0.17.tar.gz 6.8 kB Without provenance Details for Flask-Pydantic-Docs-0.0.17.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Flask-Pydantic-Docs 0.0.17
File Interpreter ABI Platform Actions
Flask_Pydantic_Docs-0.0.17-py3-none-any.whl Python 3 none any Details for Flask_Pydantic_Docs-0.0.17-py3-none-any.whl

Total release size: 15.1 kB

Release files / Flask-Pydantic-Docs-0.0.17.tar.gz

Download URL Flask-Pydantic-Docs-0.0.17.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
017cdb1e7905a1d544ee0b70ed0eec1483e8133c361f073b5d62400051f21959
BLAKE2b-256 checksum
How to use checksums
9b0e88919d738e6070a6442b25ffa29f45d52f197269f30c5b831c79676508cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

Release files / Flask_Pydantic_Docs-0.0.17-py3-none-any.whl

Download URL Flask_Pydantic_Docs-0.0.17-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c711d0e1e0d08075afabdd1baba7d06d88746fb406649a0979dd5b0bae12e66f
BLAKE2b-256 checksum
How to use checksums
7dc0acc92b0b85da951d8954aa5b0a62e2c75f01b96c4cf97e3a47adae27ded2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

Security for Flask-Pydantic-Docs 0.0.17

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page