first version zs content:
package tutorial;
struct Employee
{
uint8 age : age <= 65; // max age is 65
string name;
uint16 salary;
Role role;
// if employee is a developer, list programming skill
Experience skills[] if role == Role.DEVELOPER;
};
struct Experience
{
bit:6 yearsOfExperience;
Language programmingLanguage;
};
enum bit:2 Language
{
CPP = 0,
JAVA = 1,
PYTHON = 2,
JS = 3
};
enum uint8 Role
{
DEVELOPER = 0,
TEAM_LEAD = 1,
CTO = 2
};
struct ArrayEmployee
{
int16 numItems;
Employee list[numItems];
};
second version zs content:
struct Employee
{
uint8 age : age <= 65; // max age is 65
string name;
uint16 salary;
Role role;
// if employee is a developer, list programming skill
Experience skills[] if role == Role.DEVELOPER;
optional uint16 bonus;
};
struct Experience
{
bit:6 yearsOfExperience;
Language programmingLanguage;
};
enum bit:2 Language
{
CPP = 0,
JAVA = 1,
PYTHON = 2,
JS = 3
};
enum uint8 Role
{
DEVELOPER = 0,
TEAM_LEAD = 1,
CTO = 2
};
struct ArrayEmployee
{
int16 numItems;
Employee list[numItems];
};
problem description:
- serialize array employee used second version zs
- deserialize array employee used first version zs
- raise zserio.PythonRuntimeException
- How to solve the problem?
- How to keep backward-compatible?
first version zs content:
second version zs content:
problem description: