tukkek/infojack

Serializing Systems

Opened this issue · 0 comments

using a serialization library would be great when saving Systems later on but no solution works out-of-the-box quite yet. serializr comes close but doesn't support polymorphism plus requires redundant schema declaration.
The alternative is to roll-out a custom procedure that sanitizes/regenerates all class+subclass instances on save/load - but that's a project in and of itself.
Another options is simply not to store Systems at all since that's the only object graph that would be a major pain to serialize in a custom manner. Once the technology is caught up this can be added more easily.

https://unpkg.com/serializr
import {createModelSchema,primitive,reference,list,object,identifier,serialize,deserialize,} from './lib/serializr';
The "Create schema and store it on constructor" seems to be the most elegant when it comes to modules, since each file could easily handle its own setDefaultModelSchema() call (short of some unexpected dependency issue). See https://github.com/mobxjs/serializr .
Main blocker (polymorphism support) mobxjs/serializr#65