MCPcopy Create free account
hub / github.com/compozy/agh / validateTaskPatchTextAndSemantics

Function validateTaskPatchTextAndSemantics

internal/task/validate.go:1259–1279  ·  view source on GitHub ↗
(p Patch, path string)

Source from the content-addressed store, hash-verified

1257}
1258
1259func validateTaskPatchTextAndSemantics(p Patch, path string) error {
1260 if p.Title != nil && strings.TrimSpace(*p.Title) == "" {
1261 return fmt.Errorf("%w: %s is required when provided", ErrValidation, nestedPath(path, "title"))
1262 }
1263 if p.Priority != nil {
1264 if err := p.Priority.Validate(nestedPath(path, "priority")); err != nil {
1265 return err
1266 }
1267 }
1268 if p.MaxAttempts != nil {
1269 if err := validateTaskMaxAttempts(*p.MaxAttempts, nestedPath(path, "max_attempts"), false); err != nil {
1270 return err
1271 }
1272 }
1273 if p.ApprovalPolicy != nil {
1274 if err := p.ApprovalPolicy.Validate(nestedPath(path, "approval_policy")); err != nil {
1275 return err
1276 }
1277 }
1278 return nil
1279}
1280
1281func normalizePriorityOrDefault(priority Priority) Priority {
1282 normalized := priority.Normalize()

Callers 1

ValidateMethod · 0.85

Calls 3

validateTaskMaxAttemptsFunction · 0.85
nestedPathFunction · 0.70
ValidateMethod · 0.65

Tested by

no test coverage detected