Skip to content

Commit f16260d

Browse files
committed
Fix schema upgrade of resources
1 parent 2b56483 commit f16260d

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

R/versioning.R

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,24 @@ gldp_schema_url <- function(version = NULL) {
6666

6767
#' @noRd
6868
set_version <- function(x, version) {
69+
# Change the schema for the package
70+
x$`$schema` <- gldp_schema_url(version)
71+
72+
# Add new schema to resources
6973
x$resources <- purrr::map(x$resources %||% list(), \(r) {
7074
name <- r$name %||% NULL
7175
if (is.character(name) && length(name) == 1 && !is.na(name) && nzchar(name)) {
72-
schema <- glue::glue(
73-
"https://raw.githubusercontent.com/Rafnuss/GeoLocator-DP/{version}/{name}-table-schema.json"
76+
r$schema <- jsonlite::fromJSON(
77+
glue::glue(
78+
"https://raw.githubusercontent.com/Rafnuss/GeoLocator-DP/{version}/{name}-table-schema.json"
79+
),
80+
simplifyDataFrame = FALSE,
81+
simplifyVector = TRUE
7482
)
75-
r$`$schema` <- schema
7683
}
7784
r
7885
})
79-
x$`$schema` <- gldp_schema_url(version)
86+
8087
x
8188
}
8289

@@ -112,6 +119,8 @@ upgrade_gldp <- function(x, to_version = .gldp_default_version) {
112119
))
113120
}
114121

122+
cli_inform("Upgrading GeoLocator-DP from {.val {from_version}} to {.val {to_version}}.")
123+
115124
while (!identical(from_version, to_version)) {
116125
next_version <- switch(
117126
from_version,
@@ -125,10 +134,6 @@ upgrade_gldp <- function(x, to_version = .gldp_default_version) {
125134
NA_character_
126135
)
127136

128-
cli_inform(c(
129-
"i" = "Upgrading GeoLocator-DP from {.val {from_version}} to {.val {next_version}}."
130-
))
131-
132137
x <- switch(
133138
from_version,
134139
"main" = set_version(x, "v0.1"),

0 commit comments

Comments
 (0)