Checks types, required fields and enum values recursively. Missing values
(NULL or NA) in required fields are reported; empty arrays are allowed.
Data frames are accepted wherever the schema expects an array of objects
(each row is validated as an object), which is what ellmer and
readr return.
Examples
schema <- list(`_type` = "object",
n = list(`_type` = "integer"),
label = list(`_type` = "string", `_required` = FALSE))
validate_against_schema(list(n = 3), schema)
#> character(0)
validate_against_schema(list(n = 2.5, label = 1), schema)
#> [1] "root.n: expected an integer but got numeric '2.5'."
#> [2] "root.label: expected a string but got numeric '1'."