research.package icon indicating copy to clipboard operation
research.package copied to clipboard

RPTaskResult does not deserialize RPStepResult in results

Open jeyjey626 opened this issue 2 years ago • 1 comments

When deserializing RPTaskResult, all results in results map are deserialized as RPResult, not RPStepResult, resulting in loss of information.

https://github.com/cph-cachet/research.package/blob/c9ae9595b4dbab36f441b1db4de753a3da2a22c9/lib/src/model/result/RPTaskResult.dart#L32

jeyjey626 avatar Jun 05 '23 09:06 jeyjey626

Hi @jeyjey626 - I've looked into this.

The reason why this happens is because the different result objects have never been designed to be de-serialized from JSON into Dart objects. Normally, you would take the Dart result object and serialize it to JSON (using the toJson function) and save it to a file or database.

We never thought that you would need to read this JSON again and de-serialize it back to the app.

So - if I'm to change this, I need to know why you are doing this. What is the use case?

bardram avatar Jun 05 '23 19:06 bardram