microsoft / BotFramework-Composer

Dialog creation and management for Microsoft Bot Framework Applications
https://docs.microsoft.com/en-us/composer/
MIT License
860 stars 366 forks source link

Don't auto capitalize boolean properties #9652

Closed Nicolaasjvv closed 9 months ago

Nicolaasjvv commented 9 months ago

Describe the bug

When a property is manually set to a lowercase boolean, the composer will automatically capitalise the value (so "true" becomes "True"). This causes issues when the property is used in POST Bodies, as uppercase boolean values are not valid JSON.

Version

Version: 2.1.2 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

Browser

None. Using Bot framework emulator to test.

OS

To Reproduce

Steps to reproduce the behavior:

  1. Recreate the following dialog: image
  2. Test on emulator, see results below: image

Expected behavior

Properties set as lowercase Booleans should remain lowercase when recalled/used later in the flow. Or, Booleans should by default be lowercase.

Screenshots

See reproducing steps above.

Additional context

InfinytRam commented 9 months ago

Thanks @Nicolaasjvv, we are looking into this.

InfinytRam commented 9 months ago

Thanks @Nicolaasjvv,

I'm able to reproduce this issue: image

InfinytRam commented 9 months ago

Discussing internally with the engineering team.

InfinytRam commented 9 months ago

hey @Nicolaasjvv,

To address the JSON validity concern in POST bodies, here are two workarounds:

  1. Bypass the boolean type and set directly as a string:

    1. Example: dialog.testResults = "true"
  2. Leverage Adaptive Expressions' string() function:

    1. Example: ${string(dialog.testResults)}
    2. This will convert the boolean value to its string representation, either "true" or "false".
    3. Here is documentation for Adaptive Expression pre-built string() function
    4. Screenshot: image
InfinytRam commented 9 months ago

Closing with workaround.