Replies: 1 comment
|
FlexBuffers is a bit different from FlatBuffers in this regard because it is schema-less. There isn't a formal schema evolution mechanism with field IDs, deprecations, defaults, etc., like you get with FlatBuffers. That said, whether your example works depends largely on how the Rust serialization layer handles missing fields during deserialization. If older data is encoded as something equivalent to: {
"data": [...]
}and newer code expects: {
"kvs": {...},
"data": [...]
}then deserialization will only succeed if the new field is treated as optional or has a default value. For example: #[derive(Debug, Clone, Serialize, Deserialize)]
struct EntryData {
#[serde(default)]
kvs: HashMap<String, String>,
data: Vec<u8>,
}With More generally, FlexBuffers tends to be tolerant of:
The main compatibility concern is usually the behavior of the serializer/deserializer framework (Serde in this case), rather than FlexBuffers itself. So for your specific example, I'd expect backward compatibility to work as long as the new field has a sensible default or is represented as an |
Uh oh!
There was an error while loading. Please reload this page.
I'm using Flexbuffers Rust now. And I wonder if it supports schema evolution.
That is, now I have a struct:
And maybe I'll later extend it to:
Will the bytes encodes with the previous struct can be decoded to the later one?
All reactions