Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment to metadata json file starting with "_ #97

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion R/metadata-validate.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ deposits_meta_from_file <- function (filename = NULL,

} else {

meta <- readLines (filename)
meta <- readLines (filename, warn = FALSE)
check <- jsonlite::validate (meta)
if (!check) {
stop ("json is not valid.")
Expand All @@ -245,6 +245,10 @@ deposits_meta_from_file <- function (filename = NULL,
num_resources_local <- length (meta$resources)
meta <- meta$metadata
}

# remove comments defined names starting with "_"
meta <- meta[!grepl("^_", names(meta))]

meta <- meta [which (lapply (meta, length) > 0L)]

attr (meta, "num_resources_local") <- num_resources_local
Expand Down
8 changes: 6 additions & 2 deletions inst/extdata/dc/schema-template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"_note": "Fields like this starting with underscores are comments. Please delete this field, and all fields in this template except for those you wish to use for your deposit. This template may NOT be used in anything like this default form to construct a 'deposits' client. Many values require editing to comply with expected formats described throughout, such as dates or fields expected to accord with some fixed vocabulary, or modification from text descriptions to JSON objects. Please refer to the main 'dc/schema' file of the 'deposits' package for full details.",
mpadge marked this conversation as resolved.
Show resolved Hide resolved
"_note_1": "Fields like this starting with underscores are comments. They will be ignored when loading the metadata from the json file.",
"_note_2": "Please delete all fields in this template except for those you wish to use for your deposit. ",
"_note_3": "This template may NOT be used in anything like this default form to construct a 'deposits' client.",
"_note_4": "Many values require editing to comply with expected formats described throughout, such as dates or fields expected to accord with some fixed vocabulary, or modification from text descriptions to JSON objects.",
"_note_5": "Please refer to the main 'dc/schema' file of the 'deposits' package for full details.",
"abstract": "Abstract text",
"accessRights": "Access rights, which for Zenodo must be one of 'open', 'embargoed', 'restricted', or 'closed'.",
"accrualMethod": "See https://www.dublincore.org/specifications/dublin-core/collection-description/accrual-method/; must be one of 'deposit', 'donation', 'purchase', 'loan', 'license', or 'item_creation'",
Expand Down Expand Up @@ -80,4 +84,4 @@
"title": "A name given to the resource.",
"type": "The nature or genre of the resource. Recommended practice is to use a controlled vocabulary such as the DCMI Type Vocabulary [DCMI-TYPE]. To describe the file format, physical medium, or dimensions of the resource, use the property Format.",
"valid": "Date or date-time (often a range) of validity of a resource. Recommended practice is to describe the date, date/time, or period of time as recommended for the property Date, of which this is a subproperty."
}
}
Loading