Versions Compared

Key

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

...

  • Structures: in structures definitions declared inline for built-in types and declared a reference for custom types 


    Code Block
    languagebash
    {
        "definition": "struct",
        "name": "Foo", //fully qualified non ambiguous name
        "codec": "SCALE", //possible values SCALE or JSON
        "properties": [
            {
                "name": "enabled", //optional name
                "type": {
                    "definition": "bool"
                }
            },
            {
                "name": "id", //optional name
                "type": {
                    "definition": "struct", //reference to other struct
                    "struct_name": "Id"
                }
            },
            {
                "name": "counter", //optional name
                "type": {
                    "definition": "int",
                    "mode": "FixedWidth"
                }
            }
        ]
    }


  • Enums: similar to Structures but also every variant of enum has a discriminator that used in Scale. By default based on 0, but can be overridden by attributes


    Code Block
    {
        "definition": "enum",
        "name": "Bar", //fully qualified non ambiguous name
        "codec": "SCALE", //possible values SCALE or JSON
        "variants": [
            {
                "name": "FirstVariant",
                "discriminator": 1,
                "properties": {
                    ...
                }
            },
            {
                "name": "SecondVariant",
                "discriminator": 2,
                "properties": {
                    ...
                }
            }
        ]
    }


...