Registry / serialization / avro-validator

avro-validator

JSON →
library1.2.1pypypi✓ verified 80d ago

A pure Python Avro schema validator that validates Python dicts against Avro schemas, supporting logical types, recursive types, custom types, and JSON Schema format for union types. Current version 1.2.1, released June 2022; maintenance mode.

pip install avro-validator
INSTALL
IMPORT
SIG · AVRO-VALIDATOR
A
avro-validator
serializationpythonv1.2.1
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

Schema
from avro_validator import Schema
from avro_validator import AvroValidator
RecordType
from avro_validator import RecordType
Type
from avro_validator import Type

Create an Avro schema, validate a record, and check result.

from avro_validator import AvroValidator, AvroSchema schema = AvroSchema({ 'type': 'record', 'name': 'User', 'fields': [{'name': 'name', 'type': 'string'}, {'name': 'age', 'type': 'int'}] }) validator = AvroValidator(schema) data = {'name': 'Alice', 'age': 30} result = validator.validate(data) print(result.is_valid) # True print(result.errors) # []
Debug
Known issues
gotchavalidate() returns an AvroResult object, not a boolean. Access .is_valid and .errors.
fix
Use result.is_valid and result.errors instead of comparing result directly.
affects: all
gotchaAvroSchema expects a Python dict, not a JSON string. If you have a JSON string, parse it with json.loads first.
fix
schema_dict = json.loads(schema_str); schema = AvroSchema(schema_dict)
affects: all
gotchaThe library does not validate field defaults against the schema. A default with wrong type passes validation.
fix
Manually check defaults before validation or use a different library if strict default validation is needed.
affects: all
Upgrade
Version history
1.2.1latest on PyPI · released Jul 26, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
avro-validator — pip install avro-validator · libregistry