You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codegen for unions special-cases union members that are blobs to be handled correctly (i.e., by content, not by reference) when calculating hashcode and equality. But it does not account for union members that have nested blobs.
For example, consider DynamoDB's AttributeValue union:
sealedclassAttributeValue {
// This class is correct because the array is properly handled in equals/hashcodedata classB(valvalue:ByteArray) : AttributeValue() {
overridefunhashCode(): Int {
return value.contentHashCode()
}
overridefunequals(other:Any?): Boolean {
if (this=== other) returntrueif (other ==null||this::class!= other::class) returnfalse
other asBif (!value.contentEquals(other.value)) returnfalsereturntrue
}
}
// This class is correct because non-arrays don't need special handlingdata classBool(valvalue:Boolean) : AttributeValue()
// This class is incorrect because the arrays are hashed/compared by reference, not by contentdata classBs(valvalue:List<ByteArray>) : AttributeValue()
}
Expected behavior
The generated code for union members that contain nested blobs should codegen equals/hashcode implementations which verify content equality, not reference equality.
Current behavior
(see above)
Steps to Reproduce
(see above)
Possible Solution
No response
Context
No response
Smithy-Kotlin version
1.3.5
Platform (JVM/JS/Native)
(any)
Operating system and version
(any)
The text was updated successfully, but these errors were encountered:
Describe the bug
Codegen for unions special-cases union members that are blobs to be handled correctly (i.e., by content, not by reference) when calculating hashcode and equality. But it does not account for union members that have nested blobs.
For example, consider DynamoDB's
AttributeValue
union:Expected behavior
The generated code for union members that contain nested blobs should codegen equals/hashcode implementations which verify content equality, not reference equality.
Current behavior
(see above)
Steps to Reproduce
(see above)
Possible Solution
No response
Context
No response
Smithy-Kotlin version
1.3.5
Platform (JVM/JS/Native)
(any)
Operating system and version
(any)
The text was updated successfully, but these errors were encountered: