Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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 

  • intin SCALE integers can be encoded as fixed-width integer and compact integer. Compact integer itself has

    3

    4 modes. So generally we have

    4

    5 ways to serde integer (1 fixed-width +

    3

    4 modes of compact integers) 

    {
    Code Block
    languagebash
    {
    	"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

...