-
-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for easy versioning of structures #1137
Comments
Another caveat with it actually: I don't know what the versioning policy for serde is, but implementing it requires that serde adds a version number to all the serialized data (else if someone forgot the |
This would be immensely useful for anyone writing large amounts of data to disk in an evolving program where data structures change but old saved data still needs to be usable. |
I agree this would be valuable! Lots of users want versioning of structures and the ability to evolve over time while continuing to support old data. I am closing the issue because I believe this would be better explored as a library separate from Serde, possibly built on top of Serde. Once there is a standalone prototype and people generally agree that it meets their needs, we can reconsider whether an modifications in Serde are required to integrate better with the functionality. |
I've written something: https://github.com/avl/savefile |
@avl For the record, this means that
...for several reasons:
|
I'm not sure if there is a "blessed" library yet, but I did run across https://github.com/fredpointzero/serde-version which at least attempts to address this issue. |
@wickedchicken Not sure if I totally understood the library as I find it, based on the examples, not that useful. Would something like this even work? # Version one
{
"text": "some text"
} # Version two
{
"text": {
"somekey": "other value"
}
} |
Just adding to the discussion. |
Probably a good idea to mention this about versionize right in the thread:
|
I was thinking something like http://www.boost.org/doc/libs/1_36_0/libs/serialization/doc/tutorial.html#versioning could be expressed elegantly with attributes like (unchecked syntax):
Here, there has been a field added in version 5, which defaults to
None
when deserializing a file generated with a previous version, and in version 4 the fieldold_field
has been renamed tofield
and it's required to add"OLD "
in front of every value encoded with pre-4 versions.This would avoid the need to write custom serializer/deserializers when having to handle multiple versions of a format, and having something more transparent to the user than #745
Then this whole idea requires quite a bit of engineering, I guess, and of thought about the way to pass arguments to
build_example
.What do you think about it?
The text was updated successfully, but these errors were encountered: