Skip to main content

flask-validate-json

This is a Flask Plugin to be used for Validate JSON request data.

This package uses jsonschema to for validation: https://pypi.python.org/pypi/jsonschema

jsonschema documentation: https://json-schema.org/understanding-json-schema/index.html

Usage

This package provides a flask route decorator to validate json payload.

from flask import Flask,g
from flask_validate_json import validate_json


app = Flask(__name__)

schema = {
    'type': 'object',
    'properties': {
        'name': {'type': 'string'},
        'email': {'type': 'string'},
        'password': {'type': 'string'}
    },
    'required': ['email', 'password']
}


@app.route('/register', methods=['POST'])
@validate_json(schema)
def register():
    # if payload is invalid, request will be aborted with error code 400
    # if payload is valid it is stored in g.json_data

    # do something with your data
    # example: user = User().from_dict(g.json_data)

Metadata

Release files for flask-validate-json 0.0.1

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-validate-json 0.0.1
File Size Uploaded Provenance
flask-validate-json-0.0.1.tar.gz 3.0 kB Without provenance Details

Release files / flask-validate-json-0.0.1.tar.gz

Download URL flask-validate-json-0.0.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1ad8a0d12c7472c1a8b6cbad0875cc32035533746873be973827b1e3d3a79084
BLAKE2b-256 checksum
How to use checksums
8ce9aa8b4855636a389100f3da4dc8e5e55723c4d71497a4df193cffb3be3226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

Security for flask-validate-json 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

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