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

[.NET Templating] Resolve commas added in wrong place #7225

Merged
merged 7 commits into from
Apr 26, 2022

Conversation

anna-dingler
Copy link
Contributor

@anna-dingler anna-dingler commented Apr 26, 2022

Related Issue

Fixes #6680

Description

Commas were sometimes being added unnecessarily which resulted in invalid JSON. I updated TemplateVisitor to only add commas if there is an object prior and another object is about to be added.

Sample Card

Card:

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.3",
    "body": [
      {
        "type": "ColumnSet",
        "$data": "${foo}",
        "$when": "${$index==0}"
      },
      {
        "type": "Container",
        "$data": "${foo}",
        "$when": "${$index>0}"
      }
    ]
}

Data:

{
	"foo": [{}, {}]
}

How Verified

Verified manually and with the added unit tests.

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

@beervoley beervoley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@anna-dingler anna-dingler merged commit e53804f into microsoft:main Apr 26, 2022
@anna-dingler anna-dingler deleted the dotnetTemplating branch April 26, 2022 19:38
anna-dingler added a commit that referenced this pull request May 11, 2022
* Update expansion of Boolean expressions

* Add unit test

* Add test for property that accepts boolean

* Resolve extra commas in temaplting output
anna-dingler added a commit that referenced this pull request May 12, 2022
* Update expansion of Boolean expressions

* Add unit test

* Add test for property that accepts boolean

* Resolve extra commas in temaplting output
paulcam206 added a commit that referenced this pull request May 13, 2022
* [.NET Templating] Update Boolean expression evaluation (#7223)

* Update expansion of Boolean expressions

* Add unit test

* Add test for property that accepts boolean

* [.NET Templating] Resolve commas added in wrong place (#7225)

* Update expansion of Boolean expressions

* Add unit test

* Add test for property that accepts boolean

* Resolve extra commas in temaplting output

* [Templating] Realign platforms on invalid $when behavior (#7432)

* Align templating platforms for invalid boolean behavior

* Formatting

* Add comment for exposing warnings to caller

* [Templating] Expose warnings/errors to callers (#7437)

* In progress: log warnings

* Error log for .NET

* Add error logging for NodeJS

* Resolve comments on PR

* Consolidate ArrayList declarations and fix testing nuget package

* Rearrange Expand methods and add comments

* Refactor to add the errors to template instance

* Update warning message

* Get warnings from last template expansion

* Add markdown file changes

Co-authored-by: Paul Campbell <paulcam@microsoft.com>
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
* Update expansion of Boolean expressions

* Add unit test

* Add test for property that accepts boolean

* Resolve extra commas in temaplting output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [Templating] [dot Net] Get extra comma when binding data to an AdaptiveCardTemplate
3 participants