Skip to contents

Validate the admin.json and tasks.json Hub config files in a single call.

Usage

validate_hub_config(
  hub_path = ".",
  schema_version = "from_config",
  branch = "main"
)

Arguments

hub_path

Path to a local hub directory.

schema_version

Character string specifying the json schema version to be used for validation. The default value "from_config" will use the version specified in the schema_version property of the config file. "latest" will use the latest version available in the Infectious Disease Modeling Hubs schemas repository. Alternatively, a specific version of a schema (e.g. "v0.0.1") can be specified.

branch

The branch of the Infectious Disease Modeling Hubs schemas repository from which to fetch schema. Defaults to "main".

Value

Returns a list of the results of validation, one for each hub-config

file validated. A value of TRUE for a given file indicates that validation was successful. A value of FALSE for a given file indicates that validation errors were detected. Details of errors will be appended as a data.frame to an errors attribute. To access the errors table for a given element use attr(x, "errors")

where x is the any element of the output of the function that is FALSE. You can print a more concise and easier to view version of an errors table with view_config_val_errors().

See also

Examples

validate_hub_config(
  hub_path = system.file(
    "testhubs/simple/",
    package = "hubUtils"
  )
)
#>  Hub correctly configured! 
#> admin.json, tasks.json and model-metadata-schema.json all valid.
#> $tasks
#> [1] TRUE
#> attr(,"config_path")
#> /home/runner/work/_temp/Library/hubUtils/testhubs/simple/hub-config/tasks.json
#> attr(,"schema_version")
#> [1] "v2.0.0"
#> attr(,"schema_url")
#> https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v2.0.0/tasks-schema.json
#> 
#> $admin
#> [1] TRUE
#> attr(,"config_path")
#> /home/runner/work/_temp/Library/hubUtils/testhubs/simple/hub-config/admin.json
#> attr(,"schema_version")
#> [1] "v2.0.0"
#> attr(,"schema_url")
#> https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v2.0.0/admin-schema.json
#> 
#> $`model-metadata-schema`
#> [1] TRUE
#> attr(,"config_path")
#> /home/runner/work/_temp/Library/hubUtils/testhubs/simple/hub-config/model-metadata-schema.json
#> 
#> attr(,"config_dir")
#> /home/runner/work/_temp/Library/hubUtils/testhubs/simple/hub-config
#> attr(,"schema_version")
#> [1] "v2.0.0"
#> attr(,"schema_url")
#> [1] "https://github.com/Infectious-Disease-Modeling-Hubs/schemas/tree/main/v2.0.0"