parsec-cloud icon indicating copy to clipboard operation
parsec-cloud copied to clipboard

Rewrite the type json file to respect the `type scheme`

Open FirelightFlagboy opened this issue 3 years ago • 0 comments

The type scheme

type ProtocolScheme = {
    label: string,
    major_versions: number[],
    other_fields: Field[]
}[]

type Field = {
    name: string,
    type: string,
    introduced_in?: MajorMinorString
}

type MajorMinorString = `${Major}.${Minor}`
type Major = number
type Minor = number

Example type scheme

[
    {
        "label": "FooBarType",
        "major_versions": [
            1,
            2,
        ],
        "other_fields": [
            {
                "name": "bar",
                "type": "Int64"
            },
            {
                "name": "foo",
                "type": "FooType",
                "introduced_in": "1.1",
            }
        ]
    },
]

From the example above, we have the field foo that's is present on versions >=1.1 (including 2.*)

FirelightFlagboy avatar Sep 14 '22 07:09 FirelightFlagboy