(p Patch, path string)
| 1257 | } |
| 1258 | |
| 1259 | func 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 | |
| 1281 | func normalizePriorityOrDefault(priority Priority) Priority { |
| 1282 | normalized := priority.Normalize() |
no test coverage detected