Bug Report
List types with regex validation create nonsensical KCL that will attempt to run the regex against a stringified version of the collection instead of each individual element.
1. Minimal reproduce step (Required)
You can see this in the Karpenter types:
https://github.com/kcl-lang/modules/blob/7796cd48b4c2d0e33d288d7c84ae98e1788f294c/karpenter/v1/karpenter_sh_v1_node_pool.k#L337
There is a values?: [str] field, and the check is nonsensical:
_regex_match(str(values), r"^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$") if values
2. What did you expect to see? (Required)
I would expect values: ["a", "b", "c"] to pass validation.
3. What did you see instead (Required)
It fails validation because str(values) turns into '[a, b, c]'.
Each value should be evaluated against the regex independently, not a stringified version of the list.
4. What is your KCL components version? (Required)
0.12.3
Bug Report
List types with regex validation create nonsensical KCL that will attempt to run the regex against a stringified version of the collection instead of each individual element.
1. Minimal reproduce step (Required)
You can see this in the Karpenter types:
https://github.com/kcl-lang/modules/blob/7796cd48b4c2d0e33d288d7c84ae98e1788f294c/karpenter/v1/karpenter_sh_v1_node_pool.k#L337
There is a
values?: [str]field, and thecheckis nonsensical:2. What did you expect to see? (Required)
I would expect
values: ["a", "b", "c"]to pass validation.3. What did you see instead (Required)
It fails validation because
str(values)turns into'[a, b, c]'.Each value should be evaluated against the regex independently, not a stringified version of the list.
4. What is your KCL components version? (Required)
0.12.3