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

Method Validate

internal/task/validate.go:832–853  ·  view source on GitHub ↗

Validate reports whether the task patch contains at least one mutable field and valid values.

(path string)

Source from the content-addressed store, hash-verified

830
831// Validate reports whether the task patch contains at least one mutable field and valid values.
832func (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.
856func (r CancelTask) Validate(path string) error {

Callers 2

taskPatchFromRequestFunction · 0.95
taskPatchFromRequestFunction · 0.95

Calls 5

ValidateMetadataSizeFunction · 0.85
nestedPathFunction · 0.70
ValidateMethod · 0.65

Tested by

no test coverage detected