-
-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly mark objects as deleted or added #290
Comments
@Martin25699 This needs some dev work. I'm not sure when I will have time to do it. PR's are always welcome! Basically when comparing dictionaries, if every single key is the same but some threshold of values are different, we should just report that the whole dictionary is added or removed. |
I think this issue extends beyond dictionaries. I am doing something similar with objects and also getting "values_changed" instead of "iterable_item_added" and "iterable_item_removed" entries: from pprint import pprint
from deepdiff import DeepDiff
class Child:
def __init__(self, id:int , value: str) -> None:
self.id = id
self.value = value
class Parent:
def __init__(self, id:int , children: list[Child]) -> None:
self.id = id
self.children = children
parent_v1 = Parent(id=1, children=[Child(id=2, value="child1")])
parent_v2 = Parent(id=1, children=[Child(id=3, value="child2")])
diff = DeepDiff(parent_v1, parent_v2)
pprint(diff) Results: {'values_changed': {'root.children[0].id': {'new_value': 3, 'old_value': 2},
'root.children[0].value': {'new_value': 'child2',
'old_value': 'child1'}}} @seperman Do you think it's the same issue? |
Too sad, this feature should be coded ASAP, I wasted a lot of hours, thinking that my code was wrong 🥲 |
Hello everyone! I wanted to check in and see if there was any work being done on this issue. I am new to this repo but I can try taking a look myself. Happy to add our specific use case, but we are running into essentially the same exact flow as @Martin25699. Is anything in progress or have any reliable workarounds been found? Thanks! |
Hello,I have not had a chance to look at it yet.We will need to keep track of the portion of the nested object that is intact vs. is different and based on that decide if we should report the object as modified or removed/added.PRs are very welcome!Thanks,Sep DehpourOn Nov 2, 2023, at 8:58 AM, devin13cox ***@***.***> wrote:
Hello everyone! I wanted to check in and see if there was any work being done on this issue. I am new to this repo but I can try taking a look myself. We are running into essentially the same exact flow as @Martin25699. Is anything in progress or have any reliable workarounds been found? Thanks!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
How to correctly mark objects as deleted or added?
Actual result:
Expected Result:
The text was updated successfully, but these errors were encountered: