ropenscilabs / deposits

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

Feature Request: Comments in metadata `.json` file #94

Open rkrug opened 9 months ago

rkrug commented 9 months ago

I am using a .json file (based on the template) to define my metadata. But I like to have comments in the metadata file, to e.g. comment certain values out, explain things, etc. So I decided to implement the rule that each key starting with a _ is a commend. So I use the following now:

metadata <- system.file(
        package = "zenDep",
        params$metadata_file
    ) |>
    jsonlite::read_json()

# And filter oput al fields starting with "_" as they are considered comments
metadata <- metadata[grep("^_", names(metadata), invert = TRUE)]

cli$deposit_fill_metadata(metadata)

It would be great, if this could be implemented in the cli$deposit_fill_metadata(filename) function.

If you think there is a better option then using _ (e.g. double underscore?), please let me know. I used the underscore, as it is in the template for the note at the beginning.

mpadge commented 9 months ago

Good point. Would you like to submit a PR with that impovement? The line you have above with suffice, although pattern should be "^\\_" instead of "^_", and the best place would be just before this line: https://github.com/ropenscilabs/deposits/blob/bc3ca40a678178eee012433d43829dc9dbd95754/R/metadata-validate.R#L248 Thanks

rkrug commented 9 months ago

Will do so - but not today - but probably beginning of next week. Added to my TODO list.

rkrug commented 9 months ago

Please feel free to assign it to me (if it works)

mpadge commented 9 months ago

Great, thanks. Next week will be fine