feat: complete SOP version management
This commit is contained in:
@@ -179,12 +179,14 @@ func ValidateForPublish(startNodeKey string, nodes []model.SOPNode, edges []mode
|
||||
}
|
||||
|
||||
defaultPaths := map[string]int{}
|
||||
conditionalPaths := map[string]int{}
|
||||
for _, edge := range edges {
|
||||
adjacency[edge.SourceNodeKey] = append(adjacency[edge.SourceNodeKey], edge.TargetNodeKey)
|
||||
if isDefaultCondition(edge.Condition) {
|
||||
defaultPaths[edge.SourceNodeKey]++
|
||||
continue
|
||||
}
|
||||
conditionalPaths[edge.SourceNodeKey]++
|
||||
var rule interface{}
|
||||
if err := json.Unmarshal(edge.Condition, &rule); err != nil {
|
||||
continue
|
||||
@@ -196,6 +198,11 @@ func ValidateForPublish(startNodeKey string, nodes []model.SOPNode, edges []mode
|
||||
problems = append(problems, fmt.Sprintf("节点 %s 配置了多条默认路径", source))
|
||||
}
|
||||
}
|
||||
for source := range conditionalPaths {
|
||||
if defaultPaths[source] == 0 {
|
||||
problems = append(problems, fmt.Sprintf("节点 %s 包含条件路径但没有默认路径", source))
|
||||
}
|
||||
}
|
||||
|
||||
for _, node := range nodes {
|
||||
var config map[string]interface{}
|
||||
|
||||
Reference in New Issue
Block a user