Introduction
The Integrity platform has two types of expressions that can be used in configuration: expansions and predicates.
Expansions are expressions that contain a dot-separated path to a value and the expression itself will be replaced with the value. Expansions always result in string values and can be combined with static strings and other expressions to form the result.
Values exist in different scopes (first element of path) and different scopes are available in different situations depending on the context.
Expansion can be performed during startup (expansion of configuration values) or in runtime (expansion of data).
Expansion expressions has the following syntax: ${path.to.value}
Predicates are boolean javascript expressions that must return either true or false. Predicates are used for controlling execution and for filtering and are always evaluated during runtime.
Expansions and predicates operate on the same data structures but since they are evaluated in different environments, they will use slightly different syntax.
Expansion is basically a template rendering. The string containing one or more expressions and static values is the template and result is the rendered template.
Predicates are javascript expressions evaluated at runtime and must be valid javascript.
The biggest difference between expansions and predicates are when and how values are converted to strings. Since the goal of expansion is to produce a string, the template engine will treat all types but lists and maps as strings and if they aren’t they will be converted. In javascript all values are treated by type (object, string, array, number, etc).
Last updated