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

Adaptive expression context access with non-standard objects #4860

Open
LeonYasoon opened this issue Feb 25, 2025 · 0 comments
Open

Adaptive expression context access with non-standard objects #4860

LeonYasoon opened this issue Feb 25, 2025 · 0 comments
Labels
bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team.

Comments

@LeonYasoon
Copy link

LeonYasoon commented Feb 25, 2025

Versions

What package version of the SDK are you using. 4.23.1
What nodejs version are you using 22
What browser version are you using -
What os are you using macOS

Describe the bug

When providing a non-standard object to $root in AC.expand() when rendering adaptive cards, the context cannot access properties that are in non-standard objects.

To Reproduce

AC.expand({ $root: new DataObjectOfYourChoice({ propertyToAccess: "hasAValue" }) })

AC template: "text": "${propertyToAccess}"

Expected behavior

Text should show "hasAValue", but the property is returned as undefined

Additional context

I tried opening a fix PR for this but i'm unsure of the contribution rules in this repo of if it is even possible. Pushing to a feature branch is not allowed for my git user.

The fix would be in libraries/adaptive-expressions/src/functionUtils.internal.ts lines 221-232:

 const prop: string = Object.keys(instance).find(
      (k: string): boolean => k.toLowerCase() === property.toLowerCase(),
  );
  if (prop !== undefined) {
      value = instance[prop];
  } else if (instance[property] !== undefined || instance[property.toLowerCase()] !== undefined) {
      value = instance[property] ?? instance[property.toLowerCase()];
  }

My change is the else block.

@LeonYasoon LeonYasoon added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Feb 25, 2025
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. needs-triage The issue has just been created and it has not been reviewed by the team.
Projects
None yet
Development

No branches or pull requests

1 participant