...
- Code generation of models and serialization/deserialization tests
- Type safe checks in clients code (if programming language support type safety)
Requirements for scheme
Basically we can consider 3 types of items
1. Scalars
int: in SCALE integers can be encoded as fixed-width integer and compact integer. Compact integer itself has
34 modes. So generally we have
45 ways to serde integer (1 fixed-width +
34 modes of compact integers)
{Code Block language bash { "type": "int",
"mode": "CompactTwoByte" //possible values FixedWidth, CompactSingleByte, CompactTwoByte, CompactFourByte, CompactBigInteger,
}
- bool: no tricks here
{
"type": "bool"
}
2. Built-in containers
- Option / Result / Vec / typle / array : basically we are interested in only inner values of the container
[
{
"type": "Option",
"item_type": {
"type" : "bool"
}
},
{
"type": "Result",
"item_type": {
"type": "int",
"mode": "CompactFourByte"
}
},
{
"type": "Vec",
"item_type": {
"type": "bool"
}
}
]
3. Custom containers
- Structures
...