Skip to content

Structured Message Content

SMC is a very simple format that can be applied to JSON-like serialization formats with loose schemas.

It aims to slightly extend the self-description features of such encodings with a functionality similar to XML Namespaces, but

Consider the following JSON document

{value:1}

It's simple and compact,but we don't know what this is. The above is not a valid SMC document. Let's add the missing pieces:

{
    namespace: "https://github.com/sobamail/counter/models/v1",
    name: "IncrementRequest",
    content: {value: 1}
}

That's much better! We have now a lot more information to work with.

For MessagePack, the same serialization works, but since MessagePack is a binary format, we can compress it further by ditching string keys with predefined alternatives:

{
    0: "https://github.com/sobamail/counter/models/v1",
    1: "IncrementRequest",
    3: {value: 1}
}

The above is also a valid SMC when encoded using the msgpack format.

The following substitution table applies:

Integer Key String Key
0 "namespace"
1 "name"
2 "error"
3 "content"
4 "contentAux"
6 "wellKnownObject"

The WKO values resolve to:

Integer Key Object Key
1 {https://sobamail.com/module/base/v1}DeleteRow
2 {https://sobamail.com/module/base/v1}UpdateRow