microsoft / BotFramework-Composer

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

Form generation preview does not show examples #7889

Open chrimc62 opened 3 years ago

chrimc62 commented 3 years ago

Describe the bug

In the sorgh/fd_imp branch if you pick 'dynamiclist' as your property type, you do not see examples. I suspect this is because examples are tied to enum and it should not be. It is true that enum is special in that we want a coupling between examples and the normalized values, but we should achieve that in a different way--maybe only have examples? Both schemas have a $generator for including examples.

Version

Version: 2.0.0-nightly.246170.8fa93 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

Expected behavior

If the schema specifies examples you should be able to enter them.

Screenshots

dynamiclist without examples. image

enum with examples. image

hatpick commented 3 years ago

@chrimc62 There needs to be changes to the $generator, for example, both string(any) and enum have $generator for $examples and they are the same, while I think instead of anyOf in both one should only have "Entity array" and one should only have "Enum example object" :

"$examples": {
  "title": "Entity examples",
  "description": "Entity examples to use when generating LU files.",
  "type": "object",
  "additionalProperties": {
    "title": "Locale",
    "description": "Locale of examples or empty string for all.",
    "type": "object",
    "additionalProperties": {
      "anyOf": [
       // Currently this renders for entity
        {
          "title": "Entity",
          "type": "array",
          "items": {
            "title": "Examples",
            "description": "Examples for entity.",
            "type": "string"
          }
        },
        // Currently this renders for enum
        {
          "title": "Enum examples",
          "description": "Enum examples for each possible value.",
          "type": "object",
          "additionalProperties": {
            "title": "Enum value",
            "description": "Examples for enum value.",
            "type": "array",
            "items": {
              "title": "Enum examples",
              "description": "Examples for enum.",
              "type": "string"
            }
          }
        }
      ]
    }
  }
}