Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
func Expand(input interface{}, context interface{}) (interface{}, error)
Expand transforms json by walking the incoming input looking for Tekton expressions and translating into json output using a supplied context. Tekton expressions are represented using $(...) where the body is a Kubernetes JSONPath expression. see https://goessner.net/articles/JsonPath/index.html and https://kubernetes.io/docs/reference/kubectl/jsonpath/ Note: "range" and "end" operators are not supported and curly brackets have no special semantics are treated as string literals
Similar to CSS and XPath, JSONPath has the flexibility to return multiple results of any JSON type and expansion is handled differently depending on if the expression container is a scalar (e.g. object field or top-level), or vector (e.g. an array). 1) If expanded into a field-type the "first element" of the JSONPath result "replaces" the expression value 2) If expanded into an array-type "all elements" are appended at the expression's index Note: Tekton uses Kubernetes expansion semantics, so the expression string is returned if there is no matching results
In addition to simple JSONPath expression expansion Tekton supports string templating. Tekton expressions expanded as part of a a larger string or a string containing multiple expressions are output as text. "string" values are output as is without surrounding quotes all other types are JSON Marshalled using goland encoding/json rules. To force a JSONPath result to use string templating add an empty string literal expression to your original expression eg. $(”)$(original.expression.to.stringify)
Types ¶
This section is empty.