Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rendering] .NET Templating 2.0.0 - 2.0.3 Expand incorrectly when passed a JToken #9012

Open
justin-mellor opened this issue Sep 27, 2024 · 0 comments

Comments

@justin-mellor
Copy link

Target Platforms

Other

SDK Version

2.0.3

Application Name

Bot Framework

Problem Description

If you call Expand with a Newtonsoft.Json JToken for the data, version 1.5.0 used to expand it correctly. With 2.0.0 and above the expansion goes to an empty array instead of the string property

So with 1.5.0 you end up with
"text": "This is a title"

with 2.0.0 and above you end up with
"text": []

Screenshots

No response

Card JSON

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "${title}"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.6"
}

Sample Code Language

C#

Sample Code

var templateJson = """
    {
        "type": "AdaptiveCard",
        "body": [
            {
                "type": "TextBlock",
                "size": "Medium",
                "weight": "Bolder",
                "text": "${title}"
            }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.6"
    }
    """;

var dataJson = """
    {
        "title": "This is a title",
        "description": "Something else"
    }
    """;

var template = new AdaptiveCards.Templating.AdaptiveCardTemplate(templateJson);

var data = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JToken>(dataJson);

var card = template.Expand(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant