Skip to content

Serializing StructuredDataMessage to XML omits the message field #4141

@vy

Description

@vy

StructuredDataMessage implements MultiFormatStringBuilderFormattable and returns XML as one of its supported encodings. When StructuredDataMessage is serialized to XML, it omits the message provided at construction:

new StructuredDataMessage("an id", "a message", "a type");

gets encoded to XML as:

<StructuredData>
<type>a type</type>
<id>an id</id>
<Map>
</Map>
</StructuredData>

whereas, the following was expected:

<StructuredData>
<type>a type</type>
<id>an id</id>
<Map>
  <Entry key="message">foo</Entry>
</Map>
</StructuredData>

There is another problem: What if the user also explicitly provides a message entry:

var sdm = new StructuredDataMessage("an id", "a message", "a type");
sdm.put("message", "foo");

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAffects the public APIbugIncorrect, unexpected, or unintended behavior of existing code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To triage

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions