BotFramework-Composer icon indicating copy to clipboard operation
BotFramework-Composer copied to clipboard

Json-Schema implication support

Open ZepHakase22 opened this issue 3 years ago • 0 comments

My problem

This is my schema:

    "hasSecondFace": {
      "type": "object",
      "title": "Has second face for comparison ?",
      "additionaProperties": true,
      "properties": {
        "has": {
          "type": "boolean",
          "default": true,
          "title": "Has Second Face",
          "description": "If true ha second face else No"
        },
        "secondFace": {
          "title": "Second face to be compared",
          "additionalProperties": true,
          "required": [
            "type",
            "param"
          ],
          "oneOf": [
            {
              "type": "object",
              "title": "From Storage",
              "properties": {
                "type": {
                  "const": "fromFile"
                },
                "param": {
                  "$ref": "schema:#/definitions/stringExpression",
                  "title": "Storage key",
                  "description": "key name of the blob"
                }
              }
            },
            {
              "type": "object",
              "title": "image stream",
              "properties": {
                "type": {
                  "const": "fromKey"
                },
                "param": {
                  "$ref": "schema:#/definitions/stringExpression",
                  "title": "Stream of second face",
                  "description": "Second face to compare"
                }
              }
            }
          ]
        }
      },
      "if": {
        "properties": {
          "has": { "const": true }
        },
        "required": [ "has" ]
      },
      "then": {
        "required": [ "secondFace" ]
      },
      "else": {
        "not": { "required": [ "secondFace" ] }
      }
    }
  }

This schema is perfectly validated by Json-schema-validator. But in Composer does not work correctly. It should be:

  1. If "Has" is true "hasSecondFace" should have and is required secondFace property
  2. If "Has" is false "hasSecondFace" should not have secondFace property.

In composer:

  1. If "Has" is true works.
  2. If "Has" is false the form show anyway the secondFace property and is required. But the schema is not correctly validated.

Alternative

Trying to use "oneOf" alternative

Additional context

image

ZepHakase22 avatar Jun 25 '22 05:06 ZepHakase22