Skip to content
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

Comparison fails if the key on the left side has an array value while the right side has null value #15

Closed
richardsavio opened this issue Mar 13, 2018 · 6 comments

Comments

@richardsavio
Copy link
Contributor

richardsavio commented Mar 13, 2018

The comparison fails when the value for a key on the left side is an array and the value for the same key on the right is null. Might also fail for other comparisons where the type on the right does not have a length attribute. Haven't checked that.

It works fine if you switch sides. That is, put the JSON for the left side in the example below on the right and vice versa.

An example:
Left side:

{ "akey": [] }

Right side:

{ "akey": null }
zgrossbart added a commit that referenced this issue Mar 13, 2018
…is not an array instead of trying to compare the length and failing if one of the values is null.
@zgrossbart
Copy link
Owner

Thank you very much for this bug. Commit 3f12041 should fix this issue. I've always updated the unit tests to catch this problem in both directions. I want to do a little more testing before I push this out to jsondiff.com.

@zgrossbart
Copy link
Owner

I've finished my testing and updated jsondiff.com. This should be all set. Thanks again for the bug report.

@richardsavio
Copy link
Contributor Author

@zgrossbart A similar issue occurs for objects/dictionaries. Should I open a separate bug report?

Example:
Left side:

{ "akey": {} }

Right side:

{ "akey": null }

And thank you for fixing it so quickly. I use jsondiff quite often at work and I really appreciate all the work you put into the site.

@zgrossbart
Copy link
Owner

No need for a new bug. I'll just reopen this one.

@zgrossbart
Copy link
Owner

I'm really glad the site is useful. Change c86af7c should fix the issue for objects as well. I've added new unit tests for that case too. I'll do a little more testing and then update jsondiff.com.

@zgrossbart
Copy link
Owner

All tests have passed and I've updated jsondiff.com. This issue should be all set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants