static ArgValidator listOfType(RuntimeType type) {
        return arg -> {
            if (type == RuntimeType.ANY || arg.getType() == RuntimeType.ANY) {
                return null;
            } else if (arg.getType() == RuntimeType.ARRAY) {
                List<Object> values = arg.expectArrayValue();
                for (int i = 0; i < values.size(); i++) {
                    LiteralExpression element = LiteralExpression.from(values.get(i));
                    if (element.getType() != type) {
                        return "Expected an array of " + type + ", but found " + element.getType() + " at index " + i;
                    }
                }
            } else {
                return "Expected argument to be an array, but found " + arg.getType();
            }
            return null;
        };
    }
Defines the positional arguments, variadic arguments, and return value
of JMESPath functions.
smithy-jmespath/src/main/java/software/amazon/smithy/jmespath/FunctionDefinition.java