WebOfTrust / ietf-cesr

IETF Internet Draft Composable Event Streaming Representation (CESR) Specification
Apache License 2.0
4 stars 7 forks source link

The `version` string from stream #36

Closed blelump closed 1 year ago

blelump commented 1 year ago

Hey,

in section 3.6.2, there is a version attribute mentioned, in particular:

When the first tritet indicates its JSON, CBOR, or MGPK, then the mapping's first field 
must be a version string that provides the additional information needed to fully parse the associated encoded serialization.

The version string contains the representation and the length of the message, among other things. Is this attribute used anyhow during stream parsing, ie. for getting the explicit length of the message? What else did you have in mind by additional information?

SmithSamuelM commented 1 year ago

It is used by the parser to get the length of the message. JSON raises an error if characters past the last } are provided to loads. In general the length means we can use the version string to ensure clean parsing behavior. The protocol version, the serialization type, and the serialization length are the three main properties of the version string. The string is constructured in such a way that a Regex parser can always find it as the first field of any of the supported serializations. The terminator character _ means that the version string is extensible to future proof it so that future versions could be formatted differently if need be.

m00sey commented 1 year ago

@blelump can this be closed?