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

Decouple JSON migration builders #412

Open Whathecode opened 2 years ago

Whathecode commented 2 years ago

To implement ApiMigration, which supports migrations for backwards compatibility of incoming API requests and responses, a ApiJsonObjectMigrationBuilder and ApiJsonArrayMigrationBuilder were created. These facilitate doing common JSON transformations.

However, these seem like common requirements to anyone working with kotlin's Json, and I posted a related issue on kotlinx.serialization.

It would make sense to separate this out into a separate library. Or, at the minimum, decouple it further from the notion of API migrations. For example, currently the minimumMinorVersion and targetMinorVersion seem too tightly coupled with the migration functionality.