Files
kubevela/pkg/definition
Vaibhav Agrawal 2268d95c1c Fix: OutputsGroupIf silently dropped by component and trait CUE generators (#7100)
* Fix: add support for OutputsGroupIf in CUEGenerator and related tests

Signed-off-by: vaibhav0096 <vaibhav.agrawal0096@gmail.com>

* Fix: render OutputsGroupIf on traits with no plain Outputs sibling

The trait CUE generator previously gated the `outputs:` block on
`len(outputs) > 0`, so a trait that declared conditional resources
only via `OutputsGroupIf` (with no sibling `Outputs()` call) emitted
no outputs block at all. The grouped resources were silently dropped.

Change the gate to `len(outputs) > 0 || len(outputGroups) > 0` so the
outputs block opens whenever either plain outputs or groups are
present, matching the behavior the component generator already has.

Adds trait-side tests covering: grouped-only (the bug repro),
multiple independent groups without plain outputs, and a regression
check for plain-before-grouped ordering.

Signed-off-by: vaibhav0096 <vaibhav.agrawal0096@gmail.com>

---------

Signed-off-by: vaibhav0096 <vaibhav.agrawal0096@gmail.com>
2026-04-24 10:34:23 -07:00
..