Skip to content

Data Corruption when using PATCH API to update data section

We observed an issue with the PATCH API in the OSDU Storage service. When the PATCH API is used to update anything in the "data" section, only then the data types are changed. For example, the attribute "UNIQUE_WELL_ID": 1 gets updated to "UNIQUE_WELL_ID": 1.0 when updating any field in "data" section image

This is a blocker for one of the end users (Drilling workflow).

After RCA it was found out that the problem is in Gson library default behavior when parsing JSON.

BatchServiceImpl#getMultipleRecords()
...
Record record = gson.fromJson(recordObject, Record.class);
...

Gson's Default Strategy: When Gson encounters a number in the JSON without specific type information in the target Java object, it defaults to using Double to maintain precision. This is because a Double can represent both integer and floating-point values.

Potential solution: add customization to Gson library

related MR

Edited by Yurii Kondakov