-
Notifications
You must be signed in to change notification settings - Fork 91
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
Handle nested attribute and block definition equality with Equal() methods #753
Conversation
…thods Reference: #752 Previously before logic updates: ``` --- FAIL: TestSingleNestedAttributeEqual (0.00s) --- FAIL: TestSingleNestedAttributeEqual/different-attribute-definitions (0.00s) /Users/bflad/src/github.com/hashicorp/terraform-plugin-framework/datasource/schema/single_nested_attribute_test.go:182: unexpected difference: bool( - true, + false, ) ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just one clarifying question 🚀
if !a.GetNestedObject().Equal(b.GetNestedObject()) { | ||
return false | ||
} | ||
|
||
return AttributesEqual(a, b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason that we first compare the nested objects before we compare the attributes? If I'm understanding the BlocksEqual
function above it is the other way around (I don't think it matters either way, just curious)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope and in fact, maybe we should compare the "easier" bits first to save a little on performance. Would you want to submit a followup PR to adjust these? (I don't think they need a benchmark test or anything)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, I have no problem submitting the followup PR 👍🏻
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #752
Previously before logic updates: