Validate reports whether the task patch contains at least one mutable field and valid values.
(path string)
| 830 | |
| 831 | // Validate reports whether the task patch contains at least one mutable field and valid values. |
| 832 | func (p Patch) Validate(path string) error { |
| 833 | if !taskPatchHasMutableFields(p) { |
| 834 | return fmt.Errorf("%w: %s requires at least one mutable field", ErrValidation, path) |
| 835 | } |
| 836 | if err := validateTaskPatchTextAndSemantics(p, path); err != nil { |
| 837 | return err |
| 838 | } |
| 839 | if p.Owner != nil && p.ClearOwner { |
| 840 | return fmt.Errorf("%w: %s.owner and %s.clear_owner cannot both be set", ErrValidation, path, path) |
| 841 | } |
| 842 | if p.Owner != nil { |
| 843 | if err := p.Owner.Validate(nestedPath(path, "owner")); err != nil { |
| 844 | return err |
| 845 | } |
| 846 | } |
| 847 | if p.Metadata != nil { |
| 848 | if err := ValidateMetadataSize(*p.Metadata, nestedPath(path, "metadata")); err != nil { |
| 849 | return err |
| 850 | } |
| 851 | } |
| 852 | return nil |
| 853 | } |
| 854 | |
| 855 | // Validate reports whether the task-cancellation request is internally consistent. |
| 856 | func (r CancelTask) Validate(path string) error { |
no test coverage detected