microsoft / AdaptiveCards

A new way for developers to exchange card content in a common and consistent way.
https://adaptivecards.io
MIT License
1.76k stars 550 forks source link

[Authoring] AdaptiveCard XmlAttributes are wrong on new 1.4 card elements (DotNet) #5869

Open tomlm opened 3 years ago

tomlm commented 3 years ago

Target Application

DotNet

Problem Description

XmlAttributes are missing or wrong

Card.Refresh.UserIds shouldn't be serialized if null

Action.Execute Data serializes as JSON instead of XML.

<?xml version="1.0" encoding="utf-8"?>
<Card xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Version Major="1" Minor="4" />
  <TextBlock Size="ExtraLarge" Weight="Bolder" HorizontalAlignment="Center" Wrap="true">Super Deluxe Dice Roller</TextBlock>
  <Image Size="Large" Url="https://dice-card.azurewebsites.net/images/dice${DiceValue}.png" HorizontalAlignment="Center" />
  <ActionSet>
    <Action.Execute Title="Roll" Verb="roll">{
  "type": "adaptiveCard/action",
  "id": "${documentId}",
  "verb": "roll"
}</Action.Execute>
  </ActionSet>
  <Refresh UserIds="">
    <Action Title="Refresh" Verb="refresh">{
  "type": "adaptiveCard/action",
  "id": "${documentId}",
  "verb": "refresh"
}</Action>
  </Refresh>
</Card>

Expected Outcome

<?xml version="1.0" encoding="utf-8"?>
<Card xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Version Major="1" Minor="4" />
  <TextBlock Size="ExtraLarge" Weight="Bolder" HorizontalAlignment="Center" Wrap="true">Super Deluxe Dice Roller</TextBlock>
  <Image Size="Large" Url="https://dice-card.azurewebsites.net/images/dice${DiceValue}.png" HorizontalAlignment="Center" />
  <ActionSet>
    <Action.Execute Title="Roll" Verb="roll">
       <Data id="${documentId}" verb="roll" />
  </Action.Execute>
  </ActionSet>
  <Refresh>
    <Action Title="Refresh" Verb="refresh">
        <Data id="${documentId}" verb="roll" />
    </Action>
  </Refresh>
</Card> 

Actual Outcome

Please describe what was the actual outcome

Repro Steps

Please enter the steps to reproduce the issue

Schema Version

What JSON Schema Version are you targeting?

tomlm commented 3 years ago

We should have unit tests that round-trips every card to make sure nothing is dropped