Adaptivecards: [Templating] Complex expressions are not handled properly

Created on 26 Oct 2020  路  8Comments  路  Source: microsoft/AdaptiveCards

Platform

  • [x] JavaScript
  • [ ] .NET

Version of SDK

All versions since release

Details

The templating engine fails to correctly interpret complex expressions such as this one:

"targetElements": "${foreach(foreach(indicesAndValues(LineItems), x, concat('cardContent', x.index)), y, json(concat('{ \"elementId\": \"', y, '\", \"isVisible\": true }')))}"

The reason for this is the code mistakenly interprets the } character after \"isVisible\": true as being the end marker for the expression when it is actually a character within a string within the expression.

AdaptiveCards v21.01 Area-Templating Bug Status-Fixed Triage-Investigate javascript

Most helpful comment

@dclaux FYI... You can simplify your expression:

"targetElements": "${foreach(foreach(indicesAndValues(LineItems), x, concat('cardContent', x.index)), y, {elementId: y, isVisible: true})))}"

That's the same thing as using json() to parse a JSON based string but way easier to write :)

All 8 comments

please review this issue for target Milestone, Inconsistencies & Priority upon triage.

Hi @dclaux. We have acknowledged this issue report. Please continue to follow this issue for updates/progress/questions.

@dclaux / @jwoo-msft / @RebeccaAnne this is currently in 20.11; Based on @dclaux 's offline update this looks to be in the works for 20.10 potentially - somethings to consider before actually considering it for 20.10 though:

  • Will it have enough testing coverage to be able to land this wihtout regressions potentially @dclaux ?
  • @jwoo-msft is this something that needs to be addressed in .NET as well? If so we should update the bug title/description to include .NET also.
  • If Yes to 2 above we should look to releasing this next sprint instead with greater testing coverage and confidence. Even an expedited release if needed to account for the holidays in Nov.

Reopening until the bug is fixed in .NET as well.

Hi @dclaux. We have acknowledged this issue report. Please continue to follow this issue for updates/progress/questions.

@dclaux FYI... You can simplify your expression:

"targetElements": "${foreach(foreach(indicesAndValues(LineItems), x, concat('cardContent', x.index)), y, {elementId: y, isVisible: true})))}"

That's the same thing as using json() to parse a JSON based string but way easier to write :)

@jwoo-msft i've moved this out to 20.12 for now but do you have cycles to look into this in 20.11? @RebeccaAnne for FYI in case you are able to load balance if the Approvals team comes back wtih requests to accelerate this delivery in .NET

Was this page helpful?
0 / 5 - 0 ratings