cph-cachet / carp.core-kotlin

Infrastructure-agnostic framework for distributed data collection.
https://carp.cachet.dk/core/
MIT License
21 stars 3 forks source link

Choose a JSON type discriminator least likely to burden any language/framework #395

Open Whathecode opened 2 years ago

Whathecode commented 2 years ago

The default type discriminator is type. We changes this since that would rule out a very likely scenario of users wanting to include a type fields in the objects they extend from CARP.

First, we used $type as the JSON type discriminator. This turned out to be a bit burdensome for MongoDB, since $ has a special meaning there.

Then, we changed it to __type, but now it turns out this is burdensome for Dart serialization since _ denotes private fields which don't get serialized (possibly by the specific serialization library used at DTU; did not dig into details).

Can we come up with something that is least likely to annoy infrastructure developers?