mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
* fix(defkit): auto-detect "strings" import for StringParam MinLen/MaxLen
StringParam with MinLen or MaxLen generates CUE constraints using
strings.MinRunes() and strings.MaxRunes(), but the CUE generator only
scanned template elements for required imports — never the parameter
list itself. This caused generated definitions to fail validation with
`reference "strings" not found`.
- Implement ImportRequirer on StringParam, returning ["strings"] when
MinLen or MaxLen is set.
- Extend detectRequiredImports to scan component parameters in addition
to template helpers and resources.
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
* Adding testcases
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
* test(defkit): match multi-line CUE import block in auto-import tests
The generated CUE emits imports as a block:
import (
"strings"
)
The assertions were checking for the single-line form `import "strings"`,
which never matched. Replace with MatchRegexp(`import\s+\(\s+"strings"\s+\)`)
so the regex matches any whitespace (incl. newlines) between `import`, `(`,
`"strings"`, and `)`. Also count `"strings"` (not `import "strings"`) when
asserting the import is not duplicated.
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
* ci: retrigger checks
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>
---------
Signed-off-by: Jerrin Francis <jerrinfrancis7@gmail.com>