Files
ww/protocol/schema/wire.json

146 lines
3.4 KiB
JSON

{
"format": "wwar-v1-wire-schema",
"version": 1,
"magic_hex": "57574152",
"schema_version": 1,
"root": "one complete value; typed identities and wrappers additionally require their declared record",
"value_frame": {
"type": "u8",
"payload_length": "u64be",
"payload": "exactly payload_length bytes"
},
"container_frames": {
"list": {
"count": "u32be",
"members": "count repetitions of u64be(value_length) followed by exactly one complete value frame"
},
"map": {
"count": "u32be",
"members": "count repetitions of u64be(key_length), raw UTF-8 key, u64be(value_length), complete value frame"
},
"record": {
"count": "u32be",
"members": "count repetitions of u32be(field_tag), u64be(value_length), complete value frame"
}
},
"wire_types": [
{
"name": "bytes",
"code": 1,
"payload": {
"frame": "raw-bytes",
"canonical": [
"declared-limit",
"frame-available",
"exact-length"
]
}
},
{
"name": "string",
"code": 2,
"payload": {
"frame": "utf8",
"canonical": [
"declared-limit",
"frame-available",
"valid-utf8",
"no-nul-string",
"nfc-string",
"exact-length"
]
}
},
{
"name": "uint",
"code": 3,
"payload": {
"frame": "minimal-uint",
"canonical": [
"declared-limit",
"frame-available",
"uint-width",
"uint-minimal",
"exact-length"
]
}
},
{
"name": "bool",
"code": 4,
"payload": {
"frame": "byte",
"canonical": [
"declared-limit",
"frame-available",
"bool-00-or-01",
"exact-length"
]
}
},
{
"name": "list",
"code": 5,
"payload": {
"frame": "counted-values",
"canonical": [
"declared-limit",
"frame-available",
"declared-order",
"exact-length"
]
}
},
{
"name": "map",
"code": 6,
"payload": {
"frame": "counted-pairs",
"canonical": [
"declared-limit",
"frame-available",
"raw-utf8-key-order",
"exact-length"
]
}
},
{
"name": "record",
"code": 7,
"payload": {
"frame": "counted-fields",
"canonical": [
"declared-limit",
"frame-available",
"increasing-tag-order",
"exact-length"
]
}
}
],
"limits": {
"container_members_max": 16777215,
"nesting_depth_max": 64,
"string_or_bytes_length_max": 2147483647,
"uint_max": "18446744073709551615",
"wwar_payload_length_max": "18446744073709551615"
},
"unicode": {
"version": "16.0.0",
"form": "NFC",
"nul_forbidden": true,
"scalar_values_only": true,
"utf8": "RFC 3629 shortest form; surrogates and values above U+10FFFF are invalid",
"validation_order": [
"decode shortest-form UTF-8",
"reject NUL and non-scalar values",
"require exact NFC under Unicode 16.0.0"
]
},
"error_precedence": [
"declared limit before frame availability",
"frame truncation before type-specific or exact-length checks",
"fully framed child length mismatch before child interpretation"
]
}