Skip to main content

Module validation

Module validation 

Source
Expand description

Data validation via spreadsheets.batchUpdate (issue #1643, ADR-0077).

Two verbs, gated by DriveOperation::SheetsStructure — neither destroys data. clear-data-validation removes a constraint, not a value, the same way format.rs::UnmergeCells removes a merge without touching a cell’s content.

Shape mirrors format.rs exactly, down to reusing its target resolution: a range, composed from --sheet/--range and converted to a numeric GridRange via grid_range::parse_grid_range.

A curated condition surface, not full BooleanCondition coverage. Sheets models a couple dozen condition types. Tranche 1 (#1643) shipped the four with the broadest use: --one-of-list (dropdown), --number-between, --checkbox, --custom-formula. Tranche 2 (#1792) adds every remaining type addressable with a flat flag: ONE_OF_RANGE, the numeric comparators and NUMBER_NOT_BETWEEN, the TEXT_* contains/starts/ends/eq family, the DATE_* after/before/on/between family, and BLANK/NOT_BLANK. Absolute dates only — unlike conditional_format.rs’s identically-shaped condition, Sheets rejects a relative keyword (today, past-week, …) in data validation with a bare HTTP 400 (“relativeDate values are not supported”), so validate_condition refuses one locally instead (issue #1934). Still excluded, a documented cut rather than a silent gap: TEXT_IS_EMAIL, TEXT_IS_URL, DATE_ON_OR_BEFORE, DATE_ON_OR_AFTER, DATE_NOT_BETWEEN, DATE_IS_VALID, and every condition type meaningful only inside a conditional-format rule — docs/drive.md names the boundary, matching this issue’s general stance on CellFormat.

Structs§

ValidationOptions
Per-call options.
ValidationOutcome
The full outcome of one attempt.

Enums§

Condition
The condition shapes set-data-validation builds.
ValidationResult
What happened (or, under --dry-run, would happen).
ValidationVerb
Which mutation to perform.

Functions§

describe
Renders an outcome as human-readable text.
describe_lines
Renders an outcome as its individual lines, none of which contains a newline.
validation
Runs one data-validation mutation, logging every attempt that isn’t a dry run.