Add adaptiveCardsParserMaxVersion style options by compulim · Pull Request #3778 · microsoft/BotFramework-WebChat

Patch draft:

Note to CDN Users

Users linking the CDN /latest/webchat*.js, please note that there is a corner case of breaking changes that may apply to your Adaptive Cards.

In 4.12.0, Web Chat bumped to version 2.5 of Adaptive Cards, which utilizes the 1.3 Adaptive Cards schema. Up until now, any Adaptive Cards in Web Chat using 1.3 schema properties (with card version <1.3), did not see any validation errors occur on their card (if applicable), due to these properties being ignored. With the 4.12.0 bump, any cards (even those marked as version < 1.3) using 1.3 properties will be validated and thrown by Web Chat if exceptions are detected. For example, the property isRequired is new to Input.Text, and if set to true while missing the required errorMessage and/or label would create validation errors in Web Chat, regardless of the card's version.

How to fix - pre-4.12.1 patch

  1. Lock down the app’s Web Chat version to /4.11.0/webchat*.js until you are able to verify your Adaptive Card(s) in Adaptive Cards schema 1.3 and Web Chat 4.12.0.
    • For stability purposes, we recommend this step for all public bots. Future Web Chat bumps may be done manually to verify updates before production bots are deployed.
  2. Verify that all properties used in Adaptive Cards match the schema version of those properties. Adaptive Cards Schema Explorer
  3. After card verification, you may bump to Web Chat 4.12.0 (Or 4.12.1) using /4.12.0/webchat*.js at your earliest convenience.

Note: The Adaptive Card builder has the validateProperties() method which can be used to validate a card during development. This call will return an array of errors if applicable.

4.12.1 patch: New style property adaptiveCardsParserMaxVersion

Web Chat 4.12.1 patch includes a new style property allowing developers to choose the max Adaptive Cards schema version. See PR #3778 for code changes.

To specify a different max version, you can adjust the style options, shown below:

  window.WebChat.renderWebChat(
    {
      directLine,
      store,
      styleOptions: {
        adaptiveCardsParserMaxVersion: '1.2'
      }
    },
    document.getElementById('webchat')
  );
  • Web Chat will apply the maximum schema available according to the Adaptive Cards version (as of this patch, schema 1.3) by default.
  • An invalid version will revert to Web Chat's default.