Skip to main content

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


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 details)

Uploaded Source

File details

Details for the file pycddl-0.1.0.tar.gz.

File metadata

  • Download URL: pycddl-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pycddl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9ff8ed54bd52e43dd896d5e2e4480f751ea1c6661a21c4a7e53a7141dba152f
MD5 6fe0924cedbc0388f8136db15df66ba6
BLAKE2b-256 3ef1204fcfb4fe5840a64c68bcafc2ddef3baef062ecffe02f758848a5ba76d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page