smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
77 stars 26 forks source link

Xmlns not applied correctly for XML maps in serialization #957

Closed ianbotsf closed 10 months ago

ianbotsf commented 11 months ago

Describe the bug

A new protocol test in Smithy verifies that xmlns is correctly applied to XML maps. This test fails on current versions of smithy-kotlin.

Expected Behavior

The protocol test should pass.

Current Behavior

The test fails with the following assertion error:

expected: <<XmlMapWithXmlNamespaceInputOutput>
    <KVP xmlns="https://the-member.example.com">
        <entry>
            <K xmlns="https://the-key.example.com">a</K>
            <V xmlns="https://the-value.example.com">A</V>
        </entry>
        <entry>
            <K xmlns="https://the-key.example.com">b</K>
            <V xmlns="https://the-value.example.com">B</V>
        </entry>
    </KVP>
</XmlMapWithXmlNamespaceInputOutput>> but was: <<XmlMapWithXmlNamespaceInputOutput>
    <KVP xmlns="https://the-member.example.com">
        <entry xmlns="https://the-member.example.com">
            <K xmlns="https://the-key.example.com">a</K>
            <V xmlns="https://the-value.example.com">A</V>
        </entry>
        <entry xmlns="https://the-member.example.com">
            <K xmlns="https://the-key.example.com">b</K>
            <V xmlns="https://the-value.example.com">B</V>
        </entry>
    </KVP>
</XmlMapWithXmlNamespaceInputOutput>>

Note that the entry nodes are expected not to have an xmlns but they actually contain xmlns="https://the-member.example.com".

Steps to Reproduce

Run the latest version of Smithy's protocol tests.

Possible Solution

Fix the serialization.

Context

(n/a)

Your Environment

(n/a)