
Tabulate validation errors as a data frame
Source:R/view_config_val_errors.R
tabulate_config_val_errors.RdCompile the validation errors recorded in the output of validate_config()
or validate_hub_config() into a single data frame, processed for display.
view_config_val_errors() renders this data frame as a gt table. Other
tools, for example a GitHub Actions workflow posting a pull request comment,
can render the same errors in their own format from it.
Arguments
- x
output of
validate_config()orvalidate_hub_config().
Value
A tibble with one row per validation error, or NULL if no errors
were detected. It has the following columns:
fileName: the config file the error was found in. Only present forvalidate_hub_config()output.instancePath: location of the error in the config file.schemaPath: location of the violated rule in the schema.keyword: the schema keyword that was violated.message: description of the error, prefixed with a cross mark (❌).schema: the schema requirement that was violated.data: the value in the config file that failed validation.
A cell with nothing to show holds an empty string, not NA.
The instancePath, schemaPath and schema columns contain markdown.
Each path is laid out as a tree, one element per line, with property names
in bold and array indices converted from 0-based to 1-based.
The following attributes, all plain strings, are attached so that a caller
can reproduce the title and subtitle of the view_config_val_errors()
report:
path: the path to the config file orhub-configdirectory validated.type:"file"forvalidate_config()output,"directory"forvalidate_hub_config()output.loc_cols: the names of the columns locating each error.schema_version: the version of the schema the config was validated against.schema_url: the URL of that schema.
See also
Other functions supporting config file validation:
render_config_val_errors_html(),
validate_config(),
validate_hub_config(),
view_config_val_errors()
Examples
if (FALSE) { # \dontrun{
config_path <- system.file("error-schema/tasks-errors.json",
package = "hubUtils"
)
validate_config(config_path = config_path, config = "tasks") |>
tabulate_config_val_errors()
} # }