dw-innovation / dw-kid2-graph-frontend-prototype

dw-kid2-graph-frontend-prototype.vercel.app
MIT License
0 stars 0 forks source link

create a re-useable jsonschema for our types #61

Open nikonikoniko opened 2 years ago

nikonikoniko commented 2 years ago

we could use these jsonschemas to do runtime validation on entry to database and on retrieval to database, as well as identifying data types.

the unfortunate thing is that rxdb does not allow option jsonschemas: i.e this collection has a Block OR a Page in it. I suggest solving this by each key/type combination being the same accross types. For example, the key blocks is always a list of strings, no matter on which data type it is on. Then, I would include this key as optional on the doc datatype.

Another question is which schema library we would like to use. rxdb accepts jsonschema, so that is the likely winner, although there are other options out there.