In our current code, we assume that the template might be in any string format and so we substitute the anchors as strings. We should really start requiring the templates to be JSON, so we could treat them as dicts internally and have a better control over the special vega options. E.g. smoothing from https://github.com/iterative/dvc/issues/3906 , could be handled not with a separate template but a special plot property (https://github.com/iterative/dvc/issues/3906#issuecomment-639483890).
The initial requirement was related to HTML template support. This is where the strings come from. Later --show-vega requirements become a higher priority.
So, we can easily refuse the HTML\string requirement and move to full JSON. But this might require some minor template redesign.
TODO:
Template classTemplate._fill_metadata to one working with dict's. funcy.merge might come in handpath according to vega-lite schema.@dmpetrov noted a good point:
Some of the anchor's paths might not be constant.
Example:
setting title on axis x:
in our default template
encoding/x/title
and for linear sample for vega (not vega-lite) is different:
axes/{scale-corresponding-to-x}/title
Most helpful comment
The initial requirement was related to HTML template support. This is where the strings come from. Later
--show-vegarequirements become a higher priority.So, we can easily refuse the HTML\string requirement and move to full JSON. But this might require some minor template redesign.