BotFramework-Composer
BotFramework-Composer copied to clipboard
Json-Schema implication support
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:
- If "Has" is true "hasSecondFace" should have and is required secondFace property
- If "Has" is false "hasSecondFace" should not have secondFace property.
In composer:
- If "Has" is true works.
- 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
