Skip to contents

Validates a PEcAn events JSON file (single-site object or an array of site objects) against the bundled JSON Schema (draft 2020-12) using the AJV engine.

Usage

validate_events_json(events_json, verbose = TRUE)

Arguments

events_json

character. Path to the JSON file to validate.

verbose

logical. When `TRUE`, include detailed AJV messages on error.

Value

Logical TRUE if valid, FALSE if invalid. NA if validator unavailable.

Details

- Logs an error and returns FALSE if the JSON file does not exist or does not conform to the schema. - Logs a warning and returns TRUE if the optional package `jsonvalidate` is not installed, so calling code can proceed without a hard dependency.

Author

David LeBauer

Examples

# validate_events_json(system.file("events_fixtures/events_site1.json",
#                                package = "PEcAn.data.land"))