MCPcopy Create free account
hub / github.com/astercloud/aster / Validate

Method Validate

pkg/workflow/workflow.go:149–171  ·  view source on GitHub ↗

===== 验证 ===== Validate 验证配置

()

Source from the content-addressed store, hash-verified

147
148// Validate 验证配置
149func (w *Workflow) Validate() error {
150 if w.Name == "" {
151 return errors.New("workflow name is required")
152 }
153 if len(w.Steps) == 0 {
154 return errors.New("workflow must have at least one step")
155 }
156
157 stepNames := make(map[string]bool)
158 for _, step := range w.Steps {
159 if stepNames[step.Name()] {
160 return fmt.Errorf("duplicate step name: %s", step.Name())
161 }
162 stepNames[step.Name()] = true
163 }
164
165 if w.AddWorkflowHistory && w.DB == nil {
166 // 警告:启用了历史但没有数据库
167 fmt.Println("Warning: workflow history enabled but no database configured")
168 }
169
170 return nil
171}
172
173// ValidateInput 验证输入
174func (w *Workflow) ValidateInput(input any) error {

Callers

nothing calls this directly

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected