
Validate a data frame against a schema's canonical column declarations
Source:R/crt_schema_validate.R
crt_schema_validate.RdChecks that every column declared required: true in the schema's
canonical.cols is present in names(df). Fails loud listing all missing
required columns. Returns invisible(NULL) on success.
Value
invisible(NULL) on success. Throws fail-loud cli::cli_abort
listing all missing required columns on failure.
Details
Called by crt_ingest() AFTER handler dispatch and BEFORE
crt_schema_apply() — validate shape first (fail loud on missing required
cols), coerce types second. Without validation here, a missing required
column would silently become NA after as.integer(NULL)-style coercion in
the type-apply step; this surfaces the failure at the right layer.
Lives in the crt_schema_* family alongside crt_schema_apply() and
crt_schema_read().
Future extensions (reserved family slots; NOT in v0.0.2):
cols[].rangenumeric range checkscols[].enumvalue-membership checkscols[].predicatecustom predicate function refs
Each lands as additional cli::cli_abort branches in this function as
the schema YAML grows the corresponding declaration keys. The function
signature does not change — schema YAML drives behavior.