Troubleshoot jq Paths
Every path in a definition is a jq expression. The errors on this page name the exact expression that failed, so search your definition for that string. For the other kinds of errors, refer to Troubleshoot Definitions.
Find the Field That Failed
An error from the validator names the expression and the field that holds it. The field is in the notation of the Go type, from the Spec root of the definition. In the following output, the expression .spec.x[ is the replicasPath of the first child component:
jq Path Errors
A path can fail at two times. The validator parses every path when it validates the definition. The library compiles and runs a path when it evaluates the path against a real object.
Constructs That a Definition Does Not Allow
The validator also checks every expression statically before the library runs it. It walks the parsed jq syntax tree, and it rejects anything that changes data or can produce unbounded output:
- Assignment and update operators:
=,|=,+=,-=,*=,/=,%=, and//=. - The
delfunction. - The recursive descent operator
... - The unbounded functions
range,paths,recurse,walk, andrepeat.
Test an Expression
Test an expression against a real workload manifest with the jq command before you put it in a definition. The following command reproduces what Workload Map evaluates:
The jq playground works as well, without leaving the browser.
To check all the paths of a definition against a real workload, use karta-verify. It reports an expression that is valid but extracts nothing. For more information, refer to Define a Workload Type.
Next Steps
- To learn which object each path is evaluated against, refer to Paths in the Workload Definition Spec.
- To fix a structure error, refer to Troubleshoot Definitions.