Validates a JSON database file against the appropriate JSON schema to ensure data integrity and structure compliance.
Details
Uses JSON Schema Draft 7 for validation via the jsonvalidate package. Schemas define required fields, data types, and structure for each database type. This ensures consistency across different database files and helps catch errors early.
If jsonvalidate is not installed, validation is skipped with a message.
Examples
if (FALSE) { # \dontrun{
# Validate a measures database
errors <- validate_json_database("measures_db.json", "measures")
if (length(errors) == 0) {
message("Database is valid!")
} else {
cat("Validation errors:\n", paste(errors, collapse = "\n"))
}
# Validate unified database
errors <- validate_json_database("boilerplate_unified.json")
} # }