haxsaw/hikaru

Support dictionary lookups in object_at_path

Closed this issue · 3 comments

aantn commented

The following test doesn't pass because object_at_path can't traverse dictionaries. I think it is useful to support and can open a PR for this if you like.

def test122():
    """
    test that you can run object_at_path on the path returned by diff()
    """
    pod = Pod(
        spec=PodSpec(
            containers=[
                Container(name="a", resources=ResourceRequirements(limits={"foo": "bar"}))
            ]
        )
    )
    pod2 = copy.deepcopy(pod)
    pod2.spec.containers[0].resources.limits["foo"] = "blah"
    diff = pod.diff(pod2)
    print(diff)
    print("object at path is", pod.object_at_path(diff[0].path))

That sounds fine. Be aware though that there is now a CLA to agree to as part of submitting a PR; you can preview the text of it here: https://gist.github.com/haxsaw/394e444cb4087113beac411b2625b263.

aantn commented

Sure, that's not a problem.

Added to 0.5b