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

=concat() causes a validation error #2780

Closed
benbrown opened this issue Sep 11, 2020 · 5 comments
Closed

=concat() causes a validation error #2780

benbrown opened this issue Sep 11, 2020 · 5 comments
Assignees
Labels
Area: Adaptive expression The issue is related to Adaptive expressions
Milestone

Comments

@benbrown
Copy link
Contributor

Describe the bug

Composer throws a validation error if an expression is using concat as the returned value.

For example, use =concat('foo','bar') a field that expects a string.

Screen Shot 2020-09-11 at 3 39 48 PM

Version

1.1.1

To Reproduce

  1. Add an HTTP request step
  2. In the URL field, set the type to expression
  3. Set the value to =concat('foo','bar')

you will see a validation error

expected response

this should be a valid value since concat returns a string.

@LouisEugeneMSFT
Copy link

LouisEugeneMSFT commented Sep 12, 2020

I investigated this issue a couple days ago. My hypothesis is that this is coming from the adaptive-expressions library. Validation is made under packages/lib/indexers/src/validations/expressionValidation/validation.ts. Specifically returnType = Expression.parse(exp). Expression.parse calls the adaptive-expressions library. We can see with the example of concat that returnType yields 24 when the enum has valid properties only up to 16.

image
image
image

@cwhitten cwhitten transferred this issue from microsoft/BotFramework-Composer Sep 12, 2020
@cwhitten cwhitten added this to the R11 milestone Sep 12, 2020
@cwhitten cwhitten added the Area: Adaptive expression The issue is related to Adaptive expressions label Sep 12, 2020
@cwhitten
Copy link
Member

Transferring to botbuilder-js

@Danieladu
Copy link
Contributor

@cwhitten The concat returns 24 is because Expression library uses "bit field" of enum. (Something like IntFlag in python).
Using this feature, the built-in function can support multiple return types.
For example:
The return type of concat is String or Array, corresponding to the return type enum is 24 (8 + 16), 8 presents String, and 16 presents Array.

So, maybe should adjust the validation of returntype in Composer?

@cwhitten
Copy link
Member

Thank you @Danieladu

@boydc2014 @lei9444 should this return type instead be exported from adaptive-expressions?

@lei9444
Copy link

lei9444 commented Sep 14, 2020

Thank you @Danieladu

@boydc2014 @lei9444 should this return type instead be exported from adaptive-expressions?

hi, @cwhitten I am working on the return type in composer last week, and I will have a PR to fix it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Adaptive expression The issue is related to Adaptive expressions
Projects
None yet
Development

No branches or pull requests

6 participants