Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interpolate object parameters as JSON strings
When trating object parameters as `map`s, the interpolation of the object itself changes to the string representation of `map` instead of the previous JSON string representation. In order to keep the old behaviour of interpolating the object parameter to a JSON string, this change introduces a new type, `FormattedObject`, which implements the [`fmt.Formatter`](https://pkg.go.dev/fmt#Formatter) interface. The implemented `Format` function turns the object's string representation into a JSON string, instad of the default Go representation of a `map`. Example: ```yaml parameter: - name: foo type: object default: bar: 1 install: mymixin: # Interpolating a nested property of the object parameter. val: "${ bundle.parameter.foo.bar }" # -> `val: '1'` # Interpolating the object parameter directly. obj: "${ bundle.parameter.foo }" # -> `obj: '{"bar":1}'` ``` A shortcoming of this implementation is that interpolating nested properties which also are `map` types will result in the interpolated value being the string representation of `map`.
- Loading branch information