This provides a class to the output of the validate_ functions so that the user is given a bird's-eye view of the different problems encountered.
This also changes behavior for parsing errors: if a file is missing or malformed, the result is not an error, but an invalid result with the result of the error. The reason I chose this is because in the case of validate_hub_config(), if the model metadata config is missing (as it is in the simple hub example), then the validation fails and the error is a bit cryptic.
The output for validate_config() looks like this when there is a schema error (the error that takes 6 pages to print in the vignette):
library(hubAdmin)
config_path <- system.file("error-schema/tasks-errors.json",
package = "hubUtils")
validate_config(config_path = config_path, config = "tasks")
#> Warning: Schema errors detected in config file
#> '/home/zhian/R/x86_64-pc-linux-gnu-library/4.4/hubUtils/error-schema/tasks-errors.json'
#> validated against schema
#> <https://raw.githubusercontent.com/hubverse-org/schemas/main/v0.0.0.9/tasks-schema.json>
#> [1] FALSE
#> ! 7 schema errors: error-schema/tasks-errors.json
#> (<file:///home/zhian/R/x86_64-pc-linux-gnu-library/4.4/hubUtils/error-schema/tasks-errors.json>)
#> (via tasks-schema v0.0.0.9
#> (<https://raw.githubusercontent.com/hubverse-org/schemas/main/v0.0.0.9/tasks-schema.json>))
#> ℹ use `view_config_val_errors()` to view the errors in a table.
This provides a class to the output of the
validate_
functions so that the user is given a bird's-eye view of the different problems encountered.This also changes behavior for parsing errors: if a file is missing or malformed, the result is not an error, but an invalid result with the result of the error. The reason I chose this is because in the case of
validate_hub_config()
, if the model metadata config is missing (as it is in the simple hub example), then the validation fails and the error is a bit cryptic.The output for
validate_config()
looks like this when there is a schema error (the error that takes 6 pages to print in the vignette):Created on 2024-08-09 with reprex v2.1.1
In RStudio or positron these messages would be succinct, and you would get clickable links which means that you can immediately inspect the results.
This will fix #32