Sanity Library Reference Docs
    Preparing search index...
    • Validate, desugar, and return a workflow definition in its stored shape. Throws with a formatted, path-prefixed error message if validation fails.

      Example error:

      defineWorkflow("article-review") failed validation (2 issues):
      - stages[1].transitions[0].to: transition target "ready" is not a declared stage. Known stages: "drafting", "review", "approved"
      - predicates.allActivitiesDone: predicate "allActivitiesDone" shadows the built-in $allActivitiesDonepick another name

      Parameters

      Returns {
          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;
      }