From 460c32ab7a7953750f59b50e7e6317da9e2fb797 Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Wed, 16 Sep 2026 19:16:48 -0400 Subject: [PATCH] Fix JSON structure, adjust to httr2 Not sure when the structure changed, but needed to edit the JSON and also rename response to resp to avoid conflict with httr2 function. Recreated from PR #87 on top of devel to pick up the activitySince flaky-test fix, since the original PR branch predated that fix and its CI was failing on unrelated, already-resolved test flakiness. Co-authored-by: jwokaty <1744257+jwokaty@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5 --- R/newBiocPkgDOI.R | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/R/newBiocPkgDOI.R b/R/newBiocPkgDOI.R index f89f55c..ec56f39 100644 --- a/R/newBiocPkgDOI.R +++ b/R/newBiocPkgDOI.R @@ -59,19 +59,18 @@ generateBiocPkgDOI <- function( pkg_doi <- paste0(bioc_prefix, "/", bioc_doi_namespace, ".", pkg) payload <- list( data = list( - id = paste0("https://doi.org/", pkg_doi), - doi = stringr::str_to_upper(pkg_doi), + type = "dois", attributes = list( doi = pkg_doi, event = event, prefix = bioc_prefix, suffix = paste(bioc_doi_namespace, pkg, sep = "."), - identifiers = list( + identifiers = list(list( identifier = pkg_doi, identifierType = "DOI" - ), - creators = list(name = paste(authors, collapse = ", ")), - titles = list(title = pkg), + )), + creators = list(list(name = paste(authors, collapse = ", "))), + titles = list(list(title = pkg)), url = paste0("https://bioconductor.org/packages/", pkg), publisher = "Bioconductor", publicationYear = pubyear, @@ -80,12 +79,12 @@ generateBiocPkgDOI <- function( ) ) - response <- request(base_url) |> + resp <- request(base_url) |> req_auth_basic(username, password) |> req_headers("Content-Type" = "application/vnd.api+json") |> req_body_json(payload) |> req_perform() - resp_check_status(response) - resp_body_json(response)[[c("data", "id")]] + resp_check_status(resp) + resp_body_json(resp)[[c("data", "attributes", "doi")]] }