-
Notifications
You must be signed in to change notification settings - Fork 218
Description
#4306 fixes a bug in XmlBindingTraitSerializerGenerator.kt
exposed by a change to the S3-Control model .
The model change introduced a smithy union type that contained a unit struct as a member. This generated a match arm like:
crate::types::ObjectEncryptionFilter::Sses3(inner) =>
{
scope_writer.start_el("SSE-S3").finish();
}
inner
is never used since there is nothing to serialize for a unit struct, so this caused a warning and CI failure.
A quick review of other ${protocol}SerializerGenerator
classes shows that they likely also contain the same bug:
- CBOR:
Lines 551 to 555 in b570622
if (member.isTargetUnit()) { symbolProvider.toMemberName(member) } else { "${symbolProvider.toMemberName(member)}(inner)" } - JSON:
Lines 559 to 562 in b570622
if (member.isTargetUnit()) { "${symbolProvider.toMemberName(member)}" } else { "${symbolProvider.toMemberName(member)}(inner)" - Query:
Lines 361 to 365 in b570622
if (member.isTargetUnit()) { "${symbolProvider.toMemberName(member)}" } else { "${symbolProvider.toMemberName(member)}(inner)" }
We should fix this for all of our protocols and add some codegen tests for it (the updated S3-control model implicitly tests it for XML, but explicit tests would be better).