FUNCTION PARAMETERS/ARGUMENTS: Checks that `args` contains exactly the same keys as the list `parameterNames`. Adds the special "context" parameter containing user data.
(args map[string]any)
| 201 | // Checks that `args` contains exactly the same keys as the list `parameterNames`. |
| 202 | // Adds the special "context" parameter containing user data. |
| 203 | func (fn *functionImpl) checkArguments(args map[string]any) error { |
| 204 | // Make sure each specified parameter has a value in `args`: |
| 205 | for _, paramName := range fn.Args { |
| 206 | if _, found := args[paramName]; !found { |
| 207 | return base.HTTPErrorf(http.StatusBadRequest, "%s %q parameter %q is missing", fn.typeName, fn.name, paramName) |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | // Any extra parameters in `args` are illegal: |
| 212 | if len(args) > len(fn.Args) { |
| 213 | for _, paramName := range fn.Args { |
| 214 | delete(args, paramName) |
| 215 | } |
| 216 | for badKey := range args { |
| 217 | return base.HTTPErrorf(http.StatusBadRequest, "%s %q has no parameter %q", fn.typeName, fn.name, badKey) |
| 218 | } |
| 219 | } |
| 220 | return nil |
| 221 | } |
| 222 | |
| 223 | //////// AUTHORIZATION: |
| 224 |