[Templating] Complex expressions are not handled properly
See original GitHub issuePlatform
- 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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
refuse to parse complex JS template literals · Issue #60055
The parser would then (mostly) properly handle javascript comments, regexp, strings, etc. If we attempted to transition to another state, ...
Read more >In Mustache templating is there an elegant way of ...
I think a better way is to change the model dynamically. For example, if you are using JavaScript: model['items'][ model['items'].length - 1 ] ......
Read more >How to handle trailing commas in template loops - Terraform
I tried numerous workarounds but was not able to find a way to generate valid JSON with complex objects in loops.
Read more >Expressions | Handlebars
Handlebars expressions are the basic unit of a Handlebars template. You can use them alone in a {{mustache}} , pass them to a...
Read more >Expressions - Lit
Template structure; Non-literal statics. Lit templates can include dynamic values called expressions. An expression can be any JavaScript expression.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dclaux FYI… You can simplify your expression:
That’s the same thing as using
json()
to parse a JSON based string but way easier to write 😃@RebeccaAnne @jwoo-msft either
Status-Fixed
label should be removed, or the .NET part should be split into a new issue