powerhouse-inc / switchboard

Open-source API over the document model made to be developer- and analyst-friendly
https://switchboard-boilerplate.vercel.app
GNU Affero General Public License v3.0
3 stars 3 forks source link

Research and coordinate document schema definition #31

Closed valiafetisov closed 1 year ago

valiafetisov commented 1 year ago

Goal

Agree on the document schema definition language

Context

Since our API need to be build on top of the document model structure developed in another repository, we need to agree on what information is enough to be exported from that package in order to make integration smooth and maintainable in the future. For this, I would like to do a small research on what approaches are available, then discuss the outcomes.

Tasks

valiafetisov commented 1 year ago

Overall integration requirements

What we need

What we will provide

valiafetisov commented 1 year ago

List of qualities to judge each contender

valiafetisov commented 1 year ago

Possible contenders

KirillDogadin-std commented 1 year ago

I have a question regarding the set of qualities :

As mentioned in one of the posts you have written in past, when the document schema changes, we would have to also migrate the history of changes (operations) which are stored (i assume) in the database. Was this problem covered by one of the qualities you have listed? If so, it's not really clear how it is handled via one of the listed tools. E.g. if we take typeorm, introduce a document schema migration, how would migration of the (history-)operations be resolved?

valiafetisov commented 1 year ago

we would have to also migrate the history of changes (operations) which are stored (i assume) in the database

No, there is no such requirement, to my knowledge. We would only need to migrate the state, not operations. Each operation will store parameters passed to it as json, unstructured. I general I think it wouldn't make sense to migrate operations, since, for example it's possible that some operation that exist today will not exist in the future – this doesn't mean we need to remove it from the table of executed operations 🙂

BracketJohn commented 1 year ago

Thanks for the investigation - looks like TypeORM is the winner.

The setup would be:

Qs:

valiafetisov commented 1 year ago

Notes:

valiafetisov commented 1 year ago

Document schema was defined in a separate repo packaged via npm as @acaldas/document-model-libs. This issue is therefore replaced with https://github.com/powerhouse-inc/switchboard-boilerplate/issues/54