diff --git a/DESCRIPTION b/DESCRIPTION index e5ced71..29bd3d9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -44,7 +44,7 @@ Suggests: testthat (>= 3.2.0) Remotes: Infectious-Disease-Modeling-Hubs/hubData, - Infectious-Disease-Modeling-Hubs/hubUtils + Infectious-Disease-Modeling-Hubs/hubUtils@enhancement/v3-utils Config/Needs/website: Infectious-Disease-Modeling-Hubs/hubStyle Depends: R (>= 2.10) diff --git a/NAMESPACE b/NAMESPACE index fc7b56d..6bee1a9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -17,7 +17,6 @@ export(create_target_metadata) export(create_target_metadata_item) export(create_task_id) export(create_task_ids) -export(extract_schema_version) export(validate_config) export(validate_hub_config) export(validate_model_metadata_schema) diff --git a/R/config-schema-utils.R b/R/config-schema-utils.R index 668523a..dd04458 100644 --- a/R/config-schema-utils.R +++ b/R/config-schema-utils.R @@ -9,7 +9,7 @@ get_config_file_schema_version <- function(config_path, config) { config = config ) - version <- extract_schema_version(config_schema_version) + version <- hubUtils::extract_schema_version(config_schema_version) if (length(version) == 0L) { cli::cli_abort( diff --git a/R/create_output_type_item.R b/R/create_output_type_item.R index bd38b1a..de71697 100644 --- a/R/create_output_type_item.R +++ b/R/create_output_type_item.R @@ -267,7 +267,7 @@ create_output_type_sample <- function(is_required, output_type_id_type, max_leng schema <- download_tasks_schema(schema_version, branch) - if (extract_schema_version(schema$`$id`) < "v3.0.0") { + if (hubUtils::extract_schema_version(schema$`$id`) < "v3.0.0") { cli::cli_abort( "This function is only supported for schema versions {.val v3.0.0} and above." ) diff --git a/R/utils.R b/R/utils.R deleted file mode 100644 index 0122a65..0000000 --- a/R/utils.R +++ /dev/null @@ -1,10 +0,0 @@ -#' Extract the schema version from a schema `id` or config `schema_version` property -#' character string -#' -#' @param id A schema `id` or config `schema_version` property character string. -#' -#' @return The schema version number as a character string. -#' @export -extract_schema_version <- function(id) { - stringr::str_extract(id, "v([0-9]\\.){2}[0-9](\\.[0-9]+)?") -} diff --git a/man/extract_schema_version.Rd b/man/extract_schema_version.Rd deleted file mode 100644 index 8dc16fd..0000000 --- a/man/extract_schema_version.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{extract_schema_version} -\alias{extract_schema_version} -\title{Extract the schema version from a schema \code{id} or config \code{schema_version} property -character string} -\usage{ -extract_schema_version(id) -} -\arguments{ -\item{id}{A schema \code{id} or config \code{schema_version} property character string.} -} -\value{ -The schema version number as a character string. -} -\description{ -Extract the schema version from a schema \code{id} or config \code{schema_version} property -character string -} diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R deleted file mode 100644 index adece62..0000000 --- a/tests/testthat/test-utils.R +++ /dev/null @@ -1,7 +0,0 @@ -test_that("extract_schema_version works", { - expect_equal( - extract_schema_version( - "https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v3.0.0/tasks-schema.json" - ), "v3.0.0" - ) -})