-
Notifications
You must be signed in to change notification settings - Fork 71
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
Retro-compatibility with dates between v9 and v10 #118
Comments
Hello, I'm upping the issue because this causes compatibility troubles between applications using the v9 library and the ones migrated to the v10. Date fields are still working but the DateTime fields have changed format, causing an application using the v10 library to read We found in your documentation that you mention this compatibility issue but with no concrete documentation on how to handle it. What method do you recommend to handle this? Can we expect the JSON parser in v10 to be able to parse old datetime format (or a PR for this to be accepted, even if it will be "deprecated" and possibly removed in a v11) ? Do you recommend a configuration to pass in the library to tweak the JSON parser and have custom code to handle datetimes of the previous format? Must we convert all stored MX in JSON format back to XML with v9 based version of the application then parse & convert them again to JSON with the v10 based version? Regards |
Hi, Moving from the legacy Calendar for all type of date and time fields into a more modern model based on the new java.time model classes was indeed a breaking change. That's the reason why we made it in a major yearly release from 9 to 10. For the jaxb serialization back and forth the XML we do have some public API in the library where you can set your own adapters. However, for JSON it is fixed in the private implementation. Anyway, if you need to work with legacy JSON in version 10, one option is to create your own JSON parser/writer. The code is basically Gson on the AbstractMX class using custom adapters. Something like this:
And you can actually extend the library default adapters to tweak them. Besides this workaround, I will check and maybe we can have a 'fromJsonV9' and 'toJsonV9' directory in the model to give backward compatibility with ease. |
Hello @zubri , Thanks for your answer. For now I think the update on the SRU2024 seems to work on the messages we are using, was there other major differences than the GregorianCalendar? Also yes we had checked in the library how the JSON is parsed and as you said it's fixed in the private implementation, an interface / method to tweak the adapters would sure be useful in a generic way without forking the code and a fromJsonV9 method would really simplify migrations 🙂 |
… v10 (#129) * CU-86b15d33f_GH-118-⁃-Retro-compatibility-with-dates-between-v9-and-v10 * changelog --------- Co-authored-by: zubri <[email protected]>
We have added added backward compatibility methods fromJsonV9 and toJsonV9 to consume or produce the legacy JSON structures that we use to have for Gregorian Calendar. The adapter converts that into the java.time structure of the v10 model. This is available in SRU2024-10.2.4 and SRU2023-10.1.8 |
Hello,
Between v9 and V10 versions, the dates format have changed.
I don’t see anything in the v10 to be compatible with v9 date format.
Is there any custom adapter (or possibility to add one) to able to deserialize the « old » date format (or any other solution ) ?
Many thanks in advance.
Regards
The text was updated successfully, but these errors were encountered: