In a config modifier schema, use constant to specify that a certain value should always be returned in the processed payload. The value can be a primitive value or an object.
A constant keyword ends the processing for that specific field. Any other keywords at the same nesting level or below it are skipped.
This keyword executes in the following order:
- omit
- constant
- references
- use
- get
- Mutually exclusive keywords at this level:
- properties
- if
- concat
- switch
- pipe
- merge
- prefer
- items
- default
- plugin
You could define which value to return at a given selector based on certain conditions.
Example: Constant input from initial payload
json
Example: Constant selector
json
Example: Config modifier with constant keyword
yaml
During processing, the request checks if MSH.6.1 equals ZA310 in the initial payload. If so, the then action executes, meaning that MSH.4.1 is set to GDXIP. If MSH.6.1 doesn’t equal ZA310, the else action executes, meaning that MSH.4.1 is set to GDXAMB.
Example: Constant output
json