parsec-cloud
parsec-cloud copied to clipboard
Rewrite the type json file to respect the `type scheme`
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.*)