Closed collinschwantes closed 3 weeks ago
@collinschwantes The issue is that the metadata
argument currently only allows these two options:
https://github.com/ropenscilabs/deposits/blob/aaaf7f7ed3a3f6a587792032bf5ba245b5e3631b/R/client-main.R#L119-L127
Rendered version at https://docs.ropensci.org/deposits/reference/depositsClient.html#method-new-
What i will do in response to this is simply check first if that argument points to a "datapackage.json" file, and extract the metadata only for that.
Hmmm ... No, it's actually already in the code: https://github.com/ropenscilabs/deposits/blob/aaaf7f7ed3a3f6a587792032bf5ba245b5e3631b/R/metadata-validate.R#L242-L247
But a "datapackage.json" file should also have a "profile" field, which yours does not have. I'm not sure what you've done there, but I guess there's no harm simply easing that condition by removing "profile". Next commit will do that.
This code failed before the above commit, but now works:
library (deposits)
packageVersion ("deposits")
#> [1] '0.2.1.60'
url <- "https://github.com/user-attachments/files/16729336/datapackage.json"
destfile <- file.path (tempdir (), basename (url))
chk <- download.file (url = url, destfile = destfile)
cli <- deposits::depositsClient$new (service = "zenodo", sandbox = TRUE, metadata = destfile)
cli
#> <deposits client>
#> deposits service : zenodo
#> sandbox: TRUE
#> url_base : https://sandbox.zenodo.org/api/
#> Current deposits : <none>
#>
#> hostdata : <none>
#> metadata : 10 terms (see 'metadata' element for details)
#> local_path : /tmp/RtmpQlQKxv
#> resources : 1 local, 0 remote
Created on 2024-08-23 with reprex v2.1.1
Works for me as well - thanks!
I'm trying to update the metadata for a deposit and every method I have tried results in a dcmi term issue
retrieving and updating
Creating a new client with metadata specified from a file:
datapackage.json