Skip to main content

Workflow Validation

Workflow validation can be used to verify the contents of a workflow output file. To validate a workflow, you must have a validation script written in .cue format. A path to the script can be passed to the test command of the polywrap CLI using the validate-script option.


Validation files are written in CUE, an open-source data validation language. It has a simple syntax and is easy to use. CUE provides flexible data validation, including:

  • matching exact values
  • matching types
  • matching bounds (e.g. result > 2)
  • matching regular expressions

To validate a workflow, you must have CUE installed on your computer.

Writing a validation script#

A validation script should match the structure of the workflow it seeks to validate. It is compared against the output of the workflow.


To validate a particular job in a workflow, your validation file should be modified to match the output of that particular job.

The json-rpc demo uses a workflow and validator to replicate its full integration test suite. We've provided a sample workflow and validation script based on the json-rpc demo here:

name: json-rpc
- uri: fs/build
method: query
url: ""
method: "gas_price"
params: "[93019381]"
id: "1"