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

fix: Cast Text and Speak to string format #3844

Merged
merged 4 commits into from
Jul 2, 2021
Merged

fix: Cast Text and Speak to string format #3844

merged 4 commits into from
Jul 2, 2021

Conversation

Danieladu
Copy link
Contributor

Fixes #3832

Description

In Composer, each response would create such two default templates:

# SendActivity_DidNotUnderstand()
[Activity
    Text = ${SendActivity_DidNotUnderstand_text()}
]

# SendActivity_DidNotUnderstand_text()
- ${{grandparent: {parent1: {child1: "A", child2: "B"}, parent2: {child1: "C"}}}}

So, if the value of ${SendActivity_DidNotUnderstand_text()} is json object, the text of Activity would be object too.
The error would occur while send the activity to bot service.

Specific Changes

Cast text and speak into string format while the result is not string.

Other solutions

If we could get the property type and check if the value is this type, that would be perfect. (No suitable implementation method has been found at present)
For example,

Interface Activity {
 text: string;
 speak: string;
}

something like this:

const a: unknown= xxx;
if (IsInstanceOf(a, Activity['text'])) {
   return a;
} else {
  return CastToType(a, Activity['text'])
}

@joshgummersall is that possible?

@coveralls
Copy link

coveralls commented Jul 2, 2021

Pull Request Test Coverage Report for Build 994446427

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 84.324%

Totals Coverage Status
Change from base Build 994445849: 0.005%
Covered Lines: 19633
Relevant Lines: 22087

💛 - Coveralls

@Danieladu Danieladu marked this pull request as ready for review July 2, 2021 08:10
@Danieladu Danieladu requested review from a team as code owners July 2, 2021 08:10
@Danieladu Danieladu requested review from tomlm and luhan2017 July 2, 2021 08:10
@joshgummersall joshgummersall merged commit b47b685 into main Jul 2, 2021
@joshgummersall joshgummersall deleted the hond/cast branch July 2, 2021 18:23
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.

adaptive-expressions JSON parsing inconsistent w/ .NET
3 participants