Skip to contents

Validate a CITATION.cff file or a cff object created with cff_create() using the corresponding validation schema.json.

Usage

cff_validate(x = "CITATION.cff", verbose = TRUE)

Arguments

x

This is expected to be either a cff object created with cff_create() or the path to a CITATION.cff file to be validated.

verbose

Logical TRUE/FALSE. On TRUE the function would display informative messages.

Value

A message indicating the result of the validation and an invisible value TRUE/FALSE.

Examples

# \donttest{
# Full .cff example
cff_validate(system.file("examples/CITATION_complete.cff", package = "cffr"))
#> 
#> cff_validate results-----
#> Congratulations! This .cff file is valid

# Validate a cffr object
cffr <- cff_create("jsonlite")
class(cffr)
#> [1] "cff"
cff_validate(cffr)
#> 
#> cff_validate results-----
#> Congratulations! This cff object is valid
# }
if (FALSE) {
# .cff with errors
cff_validate(system.file("examples/CITATION_error.cff", package = "cffr"))
# If a CITATION file (note that is not .cff) it throws an error
cff_validate(system.file("CITATION", package = "cffr"))
}