Check if a decorators list is valid and matches the expected output names.
Usage
check_decorators(x, names = NULL)
assert_decorators(x, names = NULL, .var.name = checkmate::vname(x), add = NULL)Arguments
- x
(named
list) ofteal_transform_module()objects, or nested lists thereof.- names
(
character) optional vector of valid output names. When provided, all names inxmust be one of these names, and names must be unique.- .var.name
[
character(1)]
The custom name forxas passed to anyassert*function. Defaults to a heuristic name lookup.- add
If an
AssertCollectionis provided, the error message is stored in it. IfNULL, an exception is raised if res is notTRUE.
Examples
decorator <- teal_transform_module(server = function(id, data) data)
check_decorators(decorator)
#> [1] "The named list can contain a list of 'teal_transform_module' objects created using `teal_transform_module()` or be a `teal_transform_module` object."
check_decorators(list(all = decorator))
#> [1] TRUE
check_decorators(list(all = decorator, output = decorator))
#> [1] TRUE
check_decorators(list(all = decorator, output = list(decorator, decorator)))
#> [1] TRUE