ValidateWorkflowName checks if the provided workflow name is valid. It ensures the name is not empty and contains only alphanumeric characters, hyphens, and underscores.
(s string)
| 16 | // ValidateWorkflowName checks if the provided workflow name is valid. |
| 17 | // It ensures the name is not empty and contains only alphanumeric characters, hyphens, and underscores. |
| 18 | func ValidateWorkflowName(s string) error { |
| 19 | validatorsLog.Printf("Validating workflow name: %s", s) |
| 20 | if s == "" { |
| 21 | validatorsLog.Print("Workflow name validation failed: empty name") |
| 22 | return errors.New("workflow name cannot be empty") |
| 23 | } |
| 24 | if !workflowNameRegex.MatchString(s) { |
| 25 | validatorsLog.Printf("Workflow name validation failed: invalid characters in %s", s) |
| 26 | return errors.New("workflow name must contain only alphanumeric characters, hyphens, and underscores") |
| 27 | } |
| 28 | validatorsLog.Printf("Workflow name validated successfully: %s", s) |
| 29 | return nil |
| 30 | } |
| 31 | |
| 32 | // ValidateWorkflowIntent checks if the provided workflow intent is valid. |
| 33 | // It ensures the intent has meaningful content with at least 20 characters |