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.
#
CUEValidation 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 scriptA validation script should match the structure of the workflow it seeks to validate. It is compared against the output of the workflow.
tip
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:
- workflow.yaml
- validator.cue