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

Web Chat throwing 'adaptiveCard.validate is not a function' error #2068

Closed
tdurnford opened this issue Jun 11, 2019 · 2 comments · Fixed by #2075
Closed

Web Chat throwing 'adaptiveCard.validate is not a function' error #2068

tdurnford opened this issue Jun 11, 2019 · 2 comments · Fixed by #2075
Assignees
Labels
bug Indicates an unexpected problem or an unintended behavior.

Comments

@tdurnford
Copy link
Contributor

tdurnford commented Jun 11, 2019

Screenshots

image

Version

Version: 0.0.0-0
Local build from master branch

Describe the bug

In the most resent release of AdaptiveCards - v1.2 - the developers removed the validate function from the renderer. Web Chat updated the AdaptiveCards dependency in PR #2064 to v1.2; however, the AdaptiveCardRenderer component still uses the validate function. As a result, Web Chat is throwing an 'adaptiveCard.validate is not a function' error.

The CardElement.validate() and Action.validate() methods have been REMOVED, replaced with CardObject.validateProperties() and CardObject.internalValidateProperties(context: ValidationContext). Custom elements and actions now must override internalValidateProperties and add validation failures as appropriate to the context object passed as a parameter using its addFailure method. Be sure to always call super.internalValidateProperties(context) in your override.

https://www.npmjs.com/package/adaptivecards#breaking-changes

In addition to reconfiguring the AdaptiveCardRenderer component, AdaptiveCard tests should be added to prevent errors like this in the future.

To Reproduce

Send an AdaptiveCard to Web Chat

const card = CardFactory.adaptiveCard({
  "type": "AdaptiveCard",
  "body": [
      {
          "type": "TextBlock",
          "text": "AdaptiveCard"
      }
  ],
  "actions": [
      {
          "type": "Action.OpenUrl",
          "title": "Action.OpenUrl",
          "url": "https://microsoft.com"
      }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.1"
});

await context.sendActivity({ attachments: [card]});

[Bug]

@tdurnford tdurnford added bug Indicates an unexpected problem or an unintended behavior. Pending labels Jun 11, 2019
@tdurnford
Copy link
Contributor Author

It looks like AdaptiveCards also removed the speak property from the TextBlock class in v1.2, and it is still being used in the AdaptiveCardBuilder component. Web Chat throws a "Property 'speak' does not exist on type 'TextBlock'" error during build.

image

@corinagum
Copy link
Contributor

THANK YOU for all the research @tdurnford!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants