Validate CBOR documents using CDDL schema language
Project description
PyCDDL: A CDDL validation library for Python
CDDL is a schema language for the CBOR serialization format.
pycddl
allows you to validate CBOR documents match a particular CDDL schema, based on the Rust cddl
library.
For example, here we use the cbor2
library to serialize a dictionary to CBOR, and then validate it:
from pycddl import Schema
import cbor2
uint_schema = Schema("""
object = {
xint: uint
}
"""
)
uint_schema.validate_cbor(cbor2.dumps({"xint", -2}))
If validation fails, a pycddl.ValidationError
is raised.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pycddl-0.1.0.tar.gz
(5.3 kB
view hashes)