You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's currently no support for serializing plain objects with unknown shape. A temporary workaround for this is to use a custom serializer, specifying null as a target type. Naively:
attr('null',(value)=>JSON.stringify(value))
It could be possible to optimize this kind of scenario with a jit like approach:
A custom helper can handle the serialization of Objects with unknown shape
During the first serialization, JSON.stringify(value, <custom-replacer>) can be used to traverse all the properties of value and building a schema
The JSON.stringify serializer can then be replaced with the schema built in step 2
Caveats
Shape consistency:
This jit like behavior would have an appreciable performance benefit if the unknown shape stays consistent for enough time to justify the performance penalty of building the schema.
Schema invalidation:
A check should be performed on the incoming object to make sure its shape matches the one of the generated schema. Otherwise, the schema should be invalidated and recreated. This step could have a non trivial performance impact
Any idea/suggestion welcome
The text was updated successfully, but these errors were encountered:
There's currently no support for serializing plain objects with unknown shape. A temporary workaround for this is to use a custom serializer, specifying
null
as a target type. Naively:It could be possible to optimize this kind of scenario with a jit like approach:
JSON.stringify(value, <custom-replacer>)
can be used to traverse all the properties ofvalue
and building a schemaJSON.stringify
serializer can then be replaced with the schema built in step 2Caveats
Shape consistency:
This jit like behavior would have an appreciable performance benefit if the unknown shape stays consistent for enough time to justify the performance penalty of building the schema.
Schema invalidation:
A check should be performed on the incoming object to make sure its shape matches the one of the generated schema. Otherwise, the schema should be invalidated and recreated. This step could have a non trivial performance impact
Any idea/suggestion welcome
The text was updated successfully, but these errors were encountered: