cff_validate {cffr} | R Documentation |
Validate a CITATION.cff
file or a cff
object
Description
Validate a CITATION.cff
file or a cff
object using the corresponding validation schema.
Usage
cff_validate(x = "CITATION.cff", verbose = TRUE)
Arguments
x |
This is expected to be either a full |
verbose |
Logical |
Value
A message indicating the result of the validation and an invisible value
TRUE/FALSE
. On error, the results would have an attribute "errors"
containing the error summary (see Examples and attr()
).
See Also
Guide to Citation File Format schema version 1.2.0.
jsonvalidate::json_validate()
, that is the function that performs the
validation.
Other core functions of cffr:
cff()
,
cff_create()
,
cff_modify()
Examples
# Full .cff example
cff_validate(system.file("examples/CITATION_complete.cff", package = "cffr"))
# Validate a cffr object
cffr <- cff_create("jsonlite")
class(cffr)
cff_validate(cffr)
# .cff with errors
err_f <- system.file("examples/CITATION_error.cff", package = "cffr")
# Can manipulate the errors as data frame
res <- try(cff_validate(err_f))
isTRUE(res)
isFALSE(res)
attr(res, "errors")
# If a CITATION file (note that is not .cff) it throws an error
try(cff_validate(system.file("CITATION", package = "cffr")))