Use the contracts outside Python#

BTE is language-neutral: the JSON Schema, JSON-LD context, and SHACL shapes are the contracts, and any implementation should validate against the same files the reference SDK ships.

Get the files#

With battwin installed, print them:

battwin schema   > twin-envelope.schema.json
battwin context  > twin-envelope.context.jsonld

Or take them straight from the package source:

What schema validation alone gives you#

The JSON Schema is deliberately strict enough to stand on its own: structure, types, key grammars, and asserted format checks for date-times and URIs. Full conformance additionally requires the semantic rules of SPEC §5 (exactly one of source/inline per model binding, ordered validity windows, version-chain rules), which a non-Python implementation must apply itself.

Reproduce the content hash#

The hash needs no battwin code: serialize with sorted keys, (",", ":") separators, UTF-8, null-valued fields omitted, datetimes in canonical UTC-Z form, then "sha256:" + hex(sha256(bytes)). The normative definition is SPEC §4.