IfStatement 条件分支
结构声明
- TS Declaration
- Java Class
- JSON Schema
interface IfStatement {
"concept": "IfStatement", // 产品概念
"test": LogicItem, // 条件表达式
"consequent": Array<LogicItem>, // then
"alternate": Array<LogicItem>, // else
}
class IfStatementTreeNode {
ConceptEnum concept; // 产品概念
LogicItemTreeNode test; // 条件表达式
List<LogicItemTreeNode> consequent; // then
List<LogicItemTreeNode> alternate; // else
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/IfStatement",
"definitions": {
"IfStatement": {
"type": "object",
"properties": {
"concept": {
"type": "string",
"const": "IfStatement"
},
"test": {
"$ref": "#/definitions/LogicItem"
},
"consequent": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
},
"alternate": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
}
},
"required": [
"concept",
"test",
"consequent",
"alternate"
],
"additionalProperties": false
}
}
}
示例
简单示例
- JSON
- YAML
{
"concept": "IfStatement",
"test": null,
"consequent": [],
"alternate": []
}
concept: IfStatement
test: null
consequent: []
alternate: []