Validate reports whether the audit event contains the canonical persisted shape.
()
| 736 | |
| 737 | // Validate reports whether the audit event contains the canonical persisted shape. |
| 738 | func (e Event) Validate() error { |
| 739 | if strings.TrimSpace(e.ID) == "" { |
| 740 | return fmt.Errorf("%w: task_event.id is required", ErrValidation) |
| 741 | } |
| 742 | if strings.TrimSpace(e.TaskID) == "" { |
| 743 | return fmt.Errorf("%w: task_event.task_id is required", ErrValidation) |
| 744 | } |
| 745 | if strings.TrimSpace(e.EventType) == "" { |
| 746 | return fmt.Errorf("%w: task_event.event_type is required", ErrValidation) |
| 747 | } |
| 748 | if err := e.Actor.Validate("task_event.actor"); err != nil { |
| 749 | return err |
| 750 | } |
| 751 | if err := e.Origin.Validate("task_event.origin"); err != nil { |
| 752 | return err |
| 753 | } |
| 754 | if err := ValidatePayloadSize(e.Payload, "task_event.payload"); err != nil { |
| 755 | return err |
| 756 | } |
| 757 | return nil |
| 758 | } |
| 759 | |
| 760 | // Validate reports whether the persisted idempotency record contains the canonical shape. |
| 761 | func (r RunIdempotency) Validate() error { |
nothing calls this directly
no test coverage detected