SnapshotFormat
object SnapshotFormat
The canonical text codec for a Snapshot — the deterministic, human-readable, diffable artifact (BCV's lesson: a sorted golden text reviewers can read).
Guarantees:
Deterministic / byte-stable: the same snapshot always serializes to the same bytes; everything is emitted in sorted order with no environment input.
Order-invariant: because the Snapshot model normalizes its collections, reordering fields, enum values, or subtypes produces identical text.
Round-trips:
parse(serialize(s)) == sfor every extractor-produced snapshot; list values (jsonNames, enum values) escape whitespace and the comma separator, so they survive tokenization like any other token (#146).
Format (lists are comma-separated with no spaces; type refs contain no spaces):
@contract com.example.OrderEvent kind=CLASS
amountCents: Long
note: String optional
tags: List<String> optional jsonNames=[labels]
@contract com.example.OrderStatus kind=ENUM
values=[CANCELLED,CREATED,PAID]
@contract com.example.Payment kind=SEALED discriminator=type
subtypes:
ach -> com.example.AchPayment
card -> com.example.CardPayment
@config
classDiscriminator=type
...Content copied to clipboard