ValidateArgs checks if the function has at least the required number of arguments. Returns an error with a descriptive message if validation fails.
(required int)
| 103 | // ValidateArgs checks if the function has at least the required number of arguments. |
| 104 | // Returns an error with a descriptive message if validation fails. |
| 105 | func (f Function) ValidateArgs(required int) error { |
| 106 | if len(f.fn.Args) < required { |
| 107 | return fmt.Errorf("missing required arguments: need %d, got %d", required, len(f.fn.Args)) |
| 108 | } |
| 109 | return nil |
| 110 | } |
| 111 | |
| 112 | // ValidateHasPayload checks if the function has a payload. |
| 113 | // Returns an error if the payload is empty. |
no test coverage detected