🌐
PyPI
pypi.org › project › schema
schema · PyPI
schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types.
      » pip install schema
    
Published   Oct 11, 2025
Version   0.7.8
🌐
Pydantic
docs.pydantic.dev › latest
Welcome to Pydantic - Pydantic Validation
Powered by type hints — with Pydantic, schema validation and serialization are controlled by type annotations; less to learn, less code to write, and integration with your IDE and static analysis tools. Learn more… · Speed — Pydantic's core validation logic is written in Rust. As a result, Pydantic is among the fastest data validation libraries for Python...
Discussions

I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
https://github.com/mufeedvh/okjson/blob/main/okjson/validator.py It's useful to use a formatter/linter and configure your text editor to be aligned with the linter. $> pylint okjson | grep 'Bad indentation' | wc -l 100 black is a popular formatter used by the community. https://github.com/psf/black pylint is a useful listing tool. https://pylint.pycqa.org/en/latest/ Best of luck to you on your project. More on reddit.com
🌐 r/Python
4
14
March 31, 2022
validation - How to validate structure (or schema) of dictionary in Python? - Stack Overflow
schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types. More on stackoverflow.com
🌐 stackoverflow.com
Python tools/libraries to validate a JSON schema - Stack Overflow
We don’t allow questions seeking ... software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations. Closed 4 years ago. The community reviewed whether to reopen this question 4 years ago and left it closed: ... I do not want to validate an instance against a JSON schema, but I would ... More on stackoverflow.com
🌐 stackoverflow.com
Validation library for Python and JavaScript?
You are looking for JSON Schema which is a standard to define Schemas for JSON files. I don’t know for Python, but for JavaScript there are tons of options to create validated form JSON Schema More on reddit.com
🌐 r/ExperiencedDevs
6
0
November 2, 2022
🌐
Python-cerberus
docs.python-cerberus.org
Cerberus — Data validation for Python
>>> schema = {'name': {'type': 'string'}} >>> v = Validator(schema)
🌐
jsonschema
python-jsonschema.readthedocs.io › en › latest › validate
Schema Validation - jsonschema 4.26.1.dev25+gad0a1b301 documentation
The Basics: The simplest way to validate an instance under a given schema is to use the validate function. The Validator Protocol: jsonschema defines a protocol that all validator classes adhere to...
🌐
GitHub
github.com › vajol › python-data-engineering-resources › blob › main › resources › data-schema-validation.md
python-data-engineering-resources/resources/data-schema-validation.md at main · vajol/python-data-engineering-resources
Description: Cerberus is a lightweight and extensible data validation library that supports complex data structures and allows for customizable validation rules and criteria, making it highly flexible for various data validation needs. ... Description: Voluptuous is designed to validate Python data structures, ensuring that the structure and content of the data adhere to a specified schema.
Author   vajol
🌐
jsonschema
python-jsonschema.readthedocs.io
jsonschema 4.26.0 documentation
Be aware that the mere presence ... in a schema – do not activate format checks (as per the specification). Please read the format validation documentation for further details. If you have nox installed (perhaps via pipx install nox or your package manager), running nox in the directory of your source checkout will run jsonschema’s test suite on all of the versions of Python jsonschema ...
🌐
GitHub
github.com › python-openapi › openapi-schema-validator
GitHub - python-openapi/openapi-schema-validator: OpenAPI schema validator is a Python library that validates schema against OpenAPI Schema Specification v3.0 and v3.1
OpenAPI schema validator is a Python library that validates schema against OpenAPI Schema Specification v3.0 and v3.1 - python-openapi/openapi-schema-validator
Starred by 122 users
Forked by 35 users
Languages   Python 98.3% | Makefile 1.7% | Python 98.3% | Makefile 1.7%
Find elsewhere
🌐
Horejsek
horejsek.github.io › python-fastjsonschema
Fast JSON schema for Python — fastjsonschema documentation
Support only for Python 3.3 and higher. fastjsonschema implements validation of JSON documents by JSON schema. The library implements JSON schema drafts 04, 06, and 07. The main purpose is to have a really fast implementation.
🌐
Yeah Hub
yeahhub.com › 7-best-python-libraries-validating-data
7 Best Python Libraries for Validating Data – Yeah Hub
April 2, 2018 - Cerberus is a lightweight and extensible data validation library for Python. Cerberus provides type checking and other base functionality out of the box and is designed to be non-blocking and easily extensible, allowing for custom validation. It has no dependencies and is thoroughly tested ...
🌐
GitHub
github.com › mahmoudimus › awesome-validation-python
GitHub - mahmoudimus/awesome-validation-python: Python Validator Libraries
cerberus - Lightweight, extensible data validation library for Python. destructure - Easy declarative schema validation with optional name-binding.
Starred by 24 users
Forked by 4 users
🌐
Reddit
reddit.com › r/python › i wrote okjson - a fast, simple, and pythonic json schema validator
r/Python on Reddit: I wrote okjson - A fast, simple, and pythonic JSON Schema Validator
March 31, 2022 -

I had a requirement to process and validate large payloads of JSON concurrently for a web service, initially I implemented it using jsonschema and fastjsonschema but I found the whole JSON Schema Specification to be confusing at times and on top of that wanted better performance. Albeit there are ways to compile/cache the schema, I wanted to move away from the schema specification so I wrote a validation library inspired by the design of tiangolo/sqlmodel (type hints) to solve this problem easier.

Here is a simple example:

from okjson import JSONValidator

schema = { 'name': str, 'age': int }

json_string = '{ "name": "Charly Gordon", "age": 32 }'

assert JSONValidator().is_valid(instance=json_string, schema=schema)

There is an example covering all the features in the README.

It also has well defined exceptions for each error case when you want to get the reason for the validation failure. (Helpful when you want to show user facing error messages)

GitHub: https://github.com/mufeedvh/okjson

This is my first time publishing a Python library, please share your feedback/suggestions. :)

🌐
GitHub
github.com › keleshev › schema
GitHub - keleshev/schema: Schema validation just got Pythonic · GitHub
schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types.
Starred by 2.9K users
Forked by 217 users
Languages   Python
Top answer
1 of 10
76

You may use schema (PyPi Link)

schema is a library for validating Python data structures, such as those obtained from config-files, forms, external services or command-line parsing, converted from JSON/YAML (or something else) to Python data-types.

from schema import Schema, And, Use, Optional, SchemaError

def check(conf_schema, conf):
    try:
        conf_schema.validate(conf)
        return True
    except SchemaError:
        return False

conf_schema = Schema({
    'version': And(Use(int)),
    'info': {
        'conf_one': And(Use(float)),
        'conf_two': And(Use(str)),
        'conf_three': And(Use(bool)),
        Optional('optional_conf'): And(Use(str))
    }
})

conf = {
    'version': 1,
    'info': {
        'conf_one': 2.5,
        'conf_two': 'foo',
        'conf_three': False,
        'optional_conf': 'bar'
    }
}

print(check(conf_schema, conf))
2 of 10
36

Use Pydantic!

Pydantic enforces type hints at runtime, and provides user friendly errors when data is invalid. Define how data should be in pure, canonical python; validate it with pydantic, as simple as that:

from pydantic import BaseModel


class Info(BaseModel):
    conf_one: float
    conf_two: str
    conf_three: bool

    class Config:
        extra = 'forbid'


class ConfStructure(BaseModel):
    version: int
    info: Info

If validation fails pydantic will raise an error with a breakdown of what was wrong:

my_conf_wrong = {
    'version': 1,

    'info': {
        'conf_one': 2.5,
        'conf_two': 'foo',
        'conf_three': False,
        'optional_conf': 'bar'
    }
}

my_conf_right = {
    'version': 10,

    'info': {
        'conf_one': 14.5,
        'conf_two': 'something',
        'conf_three': False
    }
}

model = ConfStructure(**my_conf_right)
print(model.dict())
# {'version': 10, 'info': {'conf_one': 14.5, 'conf_two': 'something', 'conf_three': False}}

res = ConfStructure(**my_conf_wrong)
# pydantic.error_wrappers.ValidationError: 1 validation error for ConfStructure
#     info -> optional_conf
# extra fields not permitted (type=value_error.extra)
🌐
LinkedIn
linkedin.com › pulse › mastering-json-schema-validation-python-developers-guide-singh-ebffc
Mastering JSON Schema Validation with Python: A Developer’s Guide
February 16, 2024 - To kick off, ensure your Python environment is ready for JSON Schema validation. Begin with installing the jsonschema library:
🌐
Python-cerberus
docs.python-cerberus.org › schemas.html
Validation Schemas - Cerberus — Data validation for Python
There are two default registries in the cerberus module namespace where you can store definitions for schemas and rules sets which then can be referenced in a validation schema. You can furthermore instantiate more Registry objects and bind them to the rules_set_registry or schema_registry of a validator.
🌐
PyPI
pypi.org › project › jsonschema
jsonschema - JSON Schema validation for Python
>>> from jsonschema import validate >>> # A sample schema, like what we'd get from json.load() >>> schema = { ... "type" : "object", ... "properties" : { ... "price" : {"type" : "number"}, ... "name" : {"type" : "string"}, ... }, ... } >>> # If no exception is raised by validate(), the instance is valid.
      » pip install jsonschema
    
Published   Jan 07, 2026
Version   4.26.0
🌐
Gabormelli
gabormelli.com › RKB › Python_Pydantic_Schema_Validation_Library
Python Pydantic Schema Validation Library - GM-RKB
A Python Pydantic Schema Validation Library is a Python data validation library (can be used to create python data validation systems to support python data validation tasks).