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

Add adaptiveCardsParserMaxVersion style options #3778

Merged
merged 2 commits into from
Mar 5, 2021

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Mar 4, 2021

Fixes #3777.

Changelog Entry

Added

  • Resolves #3777. Added a new adaptiveCardsParserMaxVersion style options for selecting the maximum supported version when parsing an Adaptive Cards, by @compulim in PR #3778

Description

Adding a new adaptiveCardsParserMaxVersion to style options to select the "maximum version of schema to use when parsing Adaptive Cards".

Design

As mentioned in #3777, this option will give developers more time before they can tweak their cards to render truthfully with the new Adaptive Cards 2.5.0 renderer, which support card schema up to 1.3.

Specific Changes

  • Added a new adaptiveCardsParserMaxVersion style options to full and ES5 bundle
  • Added tests
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Copy link
Contributor

@corinagum corinagum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@compulim compulim merged commit ef712ba into microsoft:master Mar 5, 2021
@compulim compulim deleted the feat-ac-max-version branch March 5, 2021 11:54
@corinagum
Copy link
Contributor

corinagum commented Mar 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a style options to select Adaptive Cards parser maximum supported version
2 participants