On Tue, Sep 26, 2017 at 1:15 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Stef,
On 24 Sep 2017, at 12:26, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Hi Sven
For Moose we are wondering if we can use STON to save/load models instead of MSE. - I'm sure we can :)
Now my little friends would like to kill two or three birds with the same stone :)
Would it be possible to use STON to handle cycles but to generate JSON compatible in the following sense:
Class { "id": 123, "name" : "A" }
=>
{ "id": 123, "type" : "Class", "name" : "A" }
It means that we could be able to output an extra field and when we read that the materialiser would create an entity based on the type field for example.
Am I thinking something totally wrong?
I am not sure how to answer.
It should be possible to use STON as it is, no ?
No because they want to have JSON syntax ie. { "id": 123, "type" : "Class", "name" : "A" } and not Class { "id": 123, "name" : "A" }
JSON is different, as you know. NeoJSON was not designed to work with such dynamic types, its optional mapping mechanism works with a static type map. STON is a format with an implementation, it is not designed as a general purpose object visitor.
To me STON is nearly what we need - handling cycles - nearly JSON But else we will have to redo our own way to handle cycles again so this is why if we could avoid it would be good.
Sven
Stef