Sanity Library Reference Docs
    Preparing search index...
    • Validate a (stored, desugared) definition before deploy: parse-check every GROQ string (malformed predicates, conditions, bindings, triggers) and re-run the cross-field invariants. defineWorkflow already ran the invariants at authoring time, but deploy must reject what authoring rejects — a stored-shape definition handed straight to the verb (raw JSON, a foreign tool) would otherwise bypass every invariant.

      Plain condition sites come from conditionSitesOf — the same walker the insight surface renders from — so a condition the runtime will parse cannot escape the deploy check. Editability is checked at its AUTHORED sites: an entry's editable string alongside its other attributes (with initialValue.query), a stage tighten-override at its walker site. The walker's editable-field sites carry the derived per-stage EFFECTIVE predicate instead — a composition of those authored parts, parseable whenever they are — so they are the one site kind this check skips. GROQ strings that are not condition sites (effect bindings, op wheres, subworkflow reads, guard reads) keep their own checks below.

      Throws an Error with all problems aggregated. Reserved params don't need to be declared here — groq-js's parser doesn't know about runtime params, just syntax.

      Parameters

      • definition: {
            description?: string;
            fields?: FieldEntry[];
            groups?: Group[];
            initialStage: string;
            lifecycle?: WorkflowLifecycle;
            name: string;
            predicates?: Record<string, string>;
            roleAliases?: RoleAliases;
            semantics?: Semantic[];
            stages: Stage[];
            start?: StartBlock;
            title: string;
        }

      Returns void