Closed elominp closed 1 month ago
iso20022-core/src/main/java/com/prowidesoftware/swift/model/mx/adapters/OffsetDateTimeJsonAdapter.java (6)
`19-19`: **LGTM!** The new imports for `BigDecimal` and `Logger` are necessary and correctly added. --- `21-21`: **LGTM!** The new imports for `BigDecimal` and `Logger` are necessary and correctly added. --- `63-76`: **LGTM! Ensure comprehensive test coverage.** The enhancements to the `deserialize` method improve flexibility and robustness by handling both current and legacy DTO formats. The improved error handling and logging are beneficial for debugging. Ensure that comprehensive test coverage is in place to validate the deserialization logic. --- `78-112`: **LGTM!** The `deserializeFromOffsetDateTimeDTO` method is well-structured and correctly handles the deserialization logic for both cases where an offset is present and where it is not. --- `114-152`: **LGTM!** The `deserializeFromXMLGregorianCalendarDTO` method ensures robustness by handling uninitialized values and correctly deserializes the legacy DTO format into an `OffsetDateTime` object. --- `182-191`: **LGTM!** The `XMLGregorianCalendarDTO` class is necessary for handling the legacy DTO format and is correctly implemented with appropriate fields.iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/adapters/DateTimeJsonAdapterBackwardCompatibilityTest.java (2)
`529-534`: **LGTM!** The `v10_should_be_able_to_parse_json_with_date_time_created_from_v9` test is essential for validating the backward compatibility of the `OffsetDateTimeJsonAdapter`. --- `536-548`: **LGTM!** The `v10_should_be_able_to_parse_json_from_v9_and_read_same_content_than_json_from_v10_and_xml` test ensures consistency and correctness of the deserialization logic across different formats and versions.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Issue 118: Fix backward compatibility issue on DateTime fields seriaized from XMLGregorianCalendar objects
To be able to continue to parse JSON files generated from 9.x libraries using
AbstractMX.toJson()
when migrating to 10.x by doing anAbstractMX.fromJson()
, which is a blocker for applications that were created before the existence of the 10.x branch and wouldn't be able anymore to read their previous files.Another possibility could be to expose a public version of the
fromJson
method accepting custom adapters if you don't want to maintain the compatibility.Summary by CodeRabbit
New Features
Bug Fixes
Tests