Architecture Decision Record

ADR-0017: Object Payload Uses Canonical JSON with Optional Schema Reference

Status: Accepted · Date: 2026-03-06

Status: Accepted

Date: 2026-03-06

Context

BSFG facts must remain durable, replayable, hashable, and domain-agnostic. The object portion of a fact therefore needs a representation that is:

The design must decide whether object payloads are carried as strongly typed transport variants or as a canonicalized neutral data form.

Options Considered

Option Description Benefits Drawbacks
Typed protobuf oneof payloads Encode each supported object shape as a protobuf oneof variant.

|

| | Arbitrary JSON text | Store object payload as non-canonical JSON string bytes. |

|

| | Binary blobs only | Treat object payload as opaque bytes and leave interpretation entirely external. |

|

| | Canonical JSON bytes with optional schema reference (Selected) | Store object payload as canonical JSON bytes and allow an optional schema URI/version in the envelope. |

|

|

Decision

BSFG fact objects use canonical JSON bytes as the transport representation.

fact = (subject, predicate, object_json)

The object_json field is the canonical serialized form of the object payload. Producers and consumers may deserialize it into richer local types, but the boundary substrate treats it as canonical JSON bytes.

Schema governance is supported through an optional schema reference carried in the envelope, for example:

object_schema = "urn:bsfg:schema:batch.step_completed:v1"

BSFG does not require transport-time schema validation. Validation, compatibility checks, and stricter typing belong to producers, consumers, and domain services.

Consequences

Benefits:

Tradeoffs: