This PR make substantial enhancements to construct templates
Features
Interpolation enhancements
You can mix and match go template {{}} and existing ${} interpolation syntax in construct/binding templates.
Additionally, referencing properties containing a . is now possible using [part1.part2] syntax.
prop1: '{{ toUpper .Inputs.Input1 }}'
prop2: '${inputs:Input1}-{{ .Inputs.Input1 }}-${resources:[{{ .Inputs.Name }}]}'
prop3: '{{ if .Inputs.ReadOnly }}readonly{{ else }}readwrite{{ end }}'
Input rule enhancements
You can now write for_each-do oriented rules (mixing for_each and if in a single rule will cause an error). The do component of the rule will be executed once for each index or entry in the item selected in the for_each go template using the .Select function.
Resources added by input rules include a customizable prefix.
In a for_each, rule, use the .Select function to select a value from the current interpolation context to iterate over and reference the current selection with .Selected.
You can referenced the following within .Selected where applicable:
Input rules now contain a rules field that enables nested rules. Nested rules inherit the prefix of their parent by default. Prefix hierarchies are merged with a . separator (e.g., MyRoute.Method)
Structured inputs are now supported using the same syntax as resource template properties. Notably, model inputs are not available and resource refs (e.g. resource:Id#property are not supported)
No validation enhancements were made to this functionality -- that will be a separate effort, so most validation declared in templates is still ignored.
This PR make substantial enhancements to construct templates
Features
Interpolation enhancements
{{}}
and existing${}
interpolation syntax in construct/binding templates..
is now possible using[part1.part2]
syntax.Input rule enhancements
for_each
-do
oriented rules (mixingfor_each
andif
in a single rule will cause an error). Thedo
component of the rule will be executed once for each index or entry in the item selected in thefor_each
go template using the.Select
function.for_each
, rule, use the.Select
function to select a value from the current interpolation context to iterate over and reference the current selection with.Selected
..Selected
where applicable:.Key
.Index
.Value
rules
field that enables nested rules. Nested rules inherit theprefix
of their parent by default. Prefix hierarchies are merged with a.
separator (e.g.,MyRoute.Method
)Structured Inputs
Structured inputs are now supported using the same syntax as resource template properties. Notably,
model
inputs are not available and resource refs (e.g.resource:Id#property
are not supported)No validation enhancements were made to this functionality -- that will be a separate effort, so most validation declared in templates is still ignored.