vega / vegafusion

Serverside scaling for Vega and Altair visualizations
https://vegafusion.io
BSD 3-Clause "New" or "Revised" License
303 stars 15 forks source link

Fix patch_pre_transformed_spec when object is replaced by an array #398

Closed jonmmease closed 9 months ago

jonmmease commented 9 months ago

In the patch pre-transformed spec logic, when a JSON object is replaced by an array, it could sometimes happen that the result would be an object with integer keys (e.g. {"0": "A", "1": "BB"} instead of an array (e.g. ["A", "BB"]). I think this is a natural consequence of how JSON patching works, so I don't think it's necessarily a bug in json-patch.

This PR identifies such objects and converts them to proper arrays.