Open sduwall opened 3 years ago
I think the problem is that optional
put hidden boolean
to the serialized bytes. This hidden bit should be reflected in the first version as well:
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;
bool hasBonus; // should be always false in the first version
};
More info about hidden data in zserio can be found here.
I hope, it helps.
thank you for your answer. but this has a problem, because the first version dose not know the hasBonus.
This should not be a problem because hasBonus
should be always set to false. It can be renamed to dummy
as well:
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;
bool dummy; // should be always false in the first version
};
Thank you for your answer.
This maybe cannot solve the problem, because i cannot know the hasBonus field. After several months, this field needs to be added according to business needs. But now the first version has been sent out and cannot be modified. So reading the latest data with the first version engine will crash.
OK, I see. Unfortunately, there is currently no solution for that.
However, we have an issue in backlog because of that: https://github.com/ndsev/zserio/issues/43. You might put there some requirements.
OK, thank you for your timely answer too much.
first version zs content:
second version zs content:
problem description: