sudoblockio / tackle

Tackle is a programmable configuration language for building modular utilities, code generators, and CLIs with schema validation baked in.
Apache License 2.0
52 stars 2 forks source link

Clarify if references are preserved in context `update` #192

Open robcxyz opened 9 months ago

robcxyz commented 9 months ago

Right now references are being preserved in the update hook. For instance

input_map:
  stuff: blah
  sturf: blu

dict_map:
  foo: bing
  bar: blu

update_map:
  ->: update
  src: "{{ input_map }}"
  input:
    stuff: "{{ dict_map }}"

update in place_>: update dict_map/foo bar
def test_provider_system_hook_dicts_update_reference():
    """Show that references are preserved when updating a dict in place."""
    output = tackle('update-reference.yaml')
    assert output['update_map']['stuff']['foo'] == 'bar'

foo should be bing

So the way to fix this is if we copy the update. Only way.