| cff_validate | R Documentation |
CITATION.cff file or a cff objectValidate a CITATION.cff file or a cff object using the corresponding validation schema.
cff_validate(x = "CITATION.cff", verbose = TRUE)
x |
A full |
verbose |
A logical value. If |
Invisibly returns a logical value indicating the validation result. On
error, the result has an "errors" attribute with the error summary. If
verbose is TRUE, the function also displays the result. See Examples
and base::attr().
jsonvalidate::json_validate(), which is the function that performs the
validation.
Citation File Format schema guide.
Core cffr workflow:
cff(),
cff_create(),
cff_modify(),
cff_write()
# Full `.cff` example.
cff_validate(system.file("examples/CITATION_complete.cff", package = "cffr"))
# Validate a `cff` object.
cffr <- cff_create("jsonlite")
class(cffr)
cff_validate(cffr)
# `.cff` with errors.
err_f <- system.file("examples/CITATION_error.cff", package = "cffr")
# You can manipulate the errors as a data frame.
res <- try(cff_validate(err_f))
isTRUE(res)
isFALSE(res)
# Detailed results.
df_errors <- attr(res, "errors")
df_errors[, c("field", "message")]
# An R citation file is not a `.cff` file, so it throws an error.
try(cff_validate(system.file("CITATION", package = "cffr")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.