Skip to content

Commit

Permalink
update is_v3_* fns to use schema version utils
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Jan 10, 2025
1 parent b4ff26a commit 3fcccee
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions R/v3-schema-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @param config List representation of the JSON config file.
#'
#' @return Logical, whether the config list representation is using v3.0.0 schema.
#' @return Logical, whether the config list representation is using v3.0.0 schema or greater.
#' @export
#'
#' @examples
Expand All @@ -12,30 +12,29 @@
#' is_v3_config(config)
is_v3_config <- function(config) {
checkmate::assert_list(config)
extract_schema_version(config$schema_version) >= "v3.0.0"
version_gte("v3.0.0", config = config)
}

#' Is config file using v3.0.0 schema?
#'
#' @param config_path Path to the config file.
#'
#' @return Logical, whether the config file is using v3.0.0 schema.
#' @return Logical, whether the config file is using v3.0.0 schema or greater.
#' @export
#'
#' @examples
#' config_path <- system.file("config", "tasks.json", package = "hubUtils")
#' is_v3_config_file(config_path)
is_v3_config_file <- function(config_path) {
checkmate::assert_file_exists(config_path)
config <- read_config_file(config_path)
extract_schema_version(config$schema_version) >= "v3.0.0"
version_gte("v3.0.0", config_path = config_path)
}

#' Is hub configured using v3.0.0 schema?
#'
#' @inheritParams read_config
#'
#' @return Logical, whether the hub is configured using v3.0.0 schema.
#' @return Logical, whether the hub is configured using v3.0.0 schema or greater.
#' @export
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion man/is_v3_config.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/is_v3_config_file.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/is_v3_hub.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/subset_task_id_cols.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3fcccee

Please sign in to comment.