ropenscilabs / deposits

R Client for access to multiple data repository services
https://docs.ropensci.org/deposits/
Other
37 stars 3 forks source link

Possible bug when using `accessRights` and `license` together for zenodo metadata? #90

Closed rkrug closed 6 months ago

rkrug commented 9 months ago

First of all thanks for a brilliant package - it looks like a huge timesaver to me!

When I deposit_fill_metadata() together with license and accessRight for Zenodo I an get an error mentioning that accessRight has to be either one of the values, but it is open.

deposits installer from r-universe. Am I missing something here?

library(deposits)

sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Sonoma 14.1.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Berlin
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] deposits_0.2.1.046
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.33     styler_1.10.2     R6_2.5.1          fastmap_1.1.1    
#>  [5] xfun_0.41         magrittr_2.0.3    glue_1.6.2        R.utils_2.12.2   
#>  [9] knitr_1.45        htmltools_0.5.7   rmarkdown_2.25    lifecycle_1.0.4  
#> [13] cli_3.6.1         R.methodsS3_1.8.2 vctrs_0.6.4       reprex_2.0.2     
#> [17] withr_2.5.2       compiler_4.3.2    rprojroot_2.0.3   here_1.0.1       
#> [21] R.oo_1.25.0       R.cache_0.16.0    purrr_1.0.2       tools_4.3.2      
#> [25] evaluate_0.23     yaml_2.3.7        rlang_1.1.2       fs_1.6.3

cli <- depositsClient$new (service = "zenodo", sandbox = TRUE)

metadata <- structure(
    list(
        title = "LEEF-1 experiment",
        creator = list(
            list(
                name = "Some name"
            )
        ),
        description = "Description of the data",
        license = "CC-BY-SA-4.0",
        accessRights = "open"
    ),
    class = c(
        "metadata_bib",
        "list"
    )
)

cli$deposit_fill_metadata(metadata)
#>             instancePath                                         schemaPath
#> 1 /metadata/access_right #/properties/metadata/properties/access_right/enum
#>   keyword                       allowedValues
#> 1    enum open, embargoed, restricted, closed
#>                                      message
#> 1 must be equal to one of the allowed values
#> Error: Stopping because the metadata terms listed above do not conform with the expected schema for the zenodo service.

cli$deposit_fill_metadata(metadata[-4])

Created on 2023-12-01 with reprex v2.0.2

mpadge commented 9 months ago

Thanks @rkrug, and yes, this is definitely a bug. I'll work on a solution asap and get back to you.

mpadge commented 6 months ago

Sorry that took a while @rkrug, but with the above commit you should now see something like this:

library (deposits)
packageVersion ("deposits")
#> [1] '0.2.1.53'

cli <- depositsClient$new (service = "zenodo", sandbox = TRUE)

metadata <- structure(
    list(
        title = "LEEF-1 experiment",
        creator = list(list(
            name = "Some name"
        )),
        description = "Description of the data",
        license = "CC-BY-SA-4.0",
        accessRights = "open"
    )
)
cli$deposit_fill_metadata(metadata)
cli$deposit_new ()
#> ID of new deposit : 29650
cli$hostdata$metadata$access_right
#> [1] "open"

Created on 2024-02-19 with reprex v2.1.0

rkrug commented 6 months ago

Thanks. I will look at it in some time as I will need this for a different project as well (the employment for the one =I wanted to use this for ended.).