MatchCase 匹配分支
结构声明
- TS Declaration
- Java Class
- JSON Schema
interface MatchCase {
"concept": "MatchCase", // 产品概念
"patterns": Array<LogicItem | TypeAnnotation>, // 条件表达式
"body": Array<LogicItem>, // then
"isMatchedTypeEnumable": boolean, // 是否可枚举
}
class MatchCaseTreeNode {
ConceptEnum concept; // 产品概念
List<LogicItemTreeNode | TypeAnnotationTreeNode> patterns; // 条件表达式
List<LogicItemTreeNode> body; // then
boolean isMatchedTypeEnumable; // 是否可枚举
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/MatchCase",
"definitions": {
"MatchCase": {
"type": "object",
"properties": {
"concept": {
"type": "string",
"const": "MatchCase"
},
"patterns": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/LogicItem"
},
{
"$ref": "#/definitions/TypeAnnotation"
}
]
}
},
"body": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
},
"isMatchedTypeEnumable": {
"type": "boolean"
}
},
"required": [
"concept",
"patterns",
"body",
"isMatchedTypeEnumable"
],
"additionalProperties": false
}
}
}
示例
简单示例
- JSON
- YAML
{
"concept": "MatchCase",
"patterns": [],
"body": [],
"isMatchedTypeEnumable": false
}
concept: MatchCase
patterns: []
body: []
isMatchedTypeEnumable: false