-
Notifications
You must be signed in to change notification settings - Fork 484
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
Bot returns an error when using Regex validation in adaptive cards #6766
Comments
@ceciliaavila @tracyboehrer would it be possible to triage this item? it is impacting our customers too |
Hi @jamesemann, we'll tackle this issue this week. |
Hi @gtonye and @jamesemann, We've been reviewing the issue and debugging the provided bot to find why it is failing with the The problem is on the double backslash, since the AdaptiveCard JSON is read as a string, the double backslash is being escaped, and when the "string to object" parsing happens, the remaining backslash is interpreted as another escaping character. More information on related issue microsoft/AdaptiveCards#4677. To solve the issue, you need to provide 4 backslashes in the JSON, as shown in the image below. |
@sw-joelmut thank you for the investigation and the very detailed answer! It's very helpful context. The challenge we have is that it's going to be difficult to expose this constraint to our customers as the corrected regular expression {"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","type":"AdaptiveCard","version":"1.3","body":[{"type":"TextBlock","text":"Present a form and submit it back to the originator"},{"type":"Input.Text","id":"lastName","placeholder":"1234567890","label":"What is your phone number?","isRequired":true,"errorMessage":"A valid number is required","regex":"^\\\\(?([0-9]{3})\\\\)?[-. ]?([0-9]{3})[-. ]?([0-9 ]{4})\\\\ ?\\\\.?$"}],"actions":[{"type":"Action.Submit","title":"Submit"}]} Is there any opportunity to enhance or optimize the JSON prebuilt function to make it consistent with the behavior of the adaptive card engine? Thank you, |
Hi @gtonye, As changing the default behavior of the JSON prebuilt function will break existing customers' bots, we could try adding a flag to treat the AdaptiveCard as it is, without altering its content. |
Apologies for the delay @sw-joelmut
That would work great! let me know if you have changes that would need testing. We have several regex samples our customers use that we can share. |
Hi team,
Please let me know if you would need additional information, this is currently halting a few use cases in production for us.
Best,
Version
Describe the bug
When adding an adaptive card with escape characters, the bot throws an error:
In the bot code, the following stack trace:
To Reproduce
Expected behavior
The bot should accept the regular expression. It is valid inside the Adaptive Card Designer (with the target version 1.3) as well as valid in https://regex101.com/
Screenshots
Not applicable.
Additional context
Adaptive card I am testing with
adaptive-card-repro-ac-designer.mov
The text was updated successfully, but these errors were encountered: