OpenWorkflow supports the Standard Schema spec, which means you can use your preferred validation library to enforce type-safe contracts on workflow inputs.
Overview
When you define a workflow, you can provide a schema. OpenWorkflow uses this
schema to:
- Validate inputs at runtime: When you start a run (for example, with
ow.runWorkflow(workflow.spec, input)), the input is validated immediately. If validation fails, an error is thrown before the workflow is enqueued, preventing invalid data from entering your system. - Type Safety: The
inputparameter in your workflow function is automatically typed based on your schema.
Supported Libraries
Any library that implements the Standard Schema specification works out of the box, including:
And many more.
Examples
Zod
Valibot
ArkType
Validation Errors
When validation fails, OpenWorkflow throws a detailed error that includes information about what went wrong: