Registry / serialization / validx

validx

JSON →
library0.8.1pypypi✓ verified 81d ago

ValidX is a fast, powerful, and flexible data validation library for Python with a clean and sane syntax. It supports complex nested validations, transformations, and custom rules. Current version is 0.8.1, released under MIT license. Release cadence is irregular.

pip install validx
INSTALL
IMPORT
SIG · VALIDX
V
validx
serializationpythonv0.8.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Validator
from validx import Validator
from validx import validate
Int
from validx import Int
Str
from validx import Str

Basic usage: define a schema using Python types, then call validate().

from validx import validate schema = { "name": str, "age": int, "email": str } data = {"name": "Alice", "age": 30, "email": "alice@example.com"} result = validate(schema, data) print(result.valid) # True if valid, False otherwise print(result.errors) # Empty list if valid
Debug
Known issues
deprecatedIn versions < 0.8.0, `validate` returned a tuple (valid, errors). In 0.8.0+ it returns a Result object with attributes .valid and .errors.
fix
Update code to use .valid and .errors attributes instead of tuple unpacking.
affects: <0.8.0
gotchaNested schemas must be defined as dicts, not as tuples or lists. Using a tuple for a nested validation will be treated as a sequence validator, not a dict validator.
fix
Always use dict for object schemas: {'nested': {'key': int}}
affects: all
Upgrade
Version history
0.8.1latest on PyPI · released Jul 20, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
validx — pip install validx · libregistry