Open
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
schema User[arg: Arg]:
name: str = "${arg.envName}"
schema Arg:
envName: "staging" | "production"
_user = User({})
_user
kcl hello.k
2. What did you expect to see? (Required)
An error occurs because the argument {}
doesn't meet Arg
.
Error: EvaluationError
--> /Users/shunsukesuzuki/Documents/test/kcl/validation/hello.k:7:1
|
7 | _user = User({})
| attribute 'envName' of Arg is required and can't be None or Undefined
|
3. What did you see instead (Required)
KCL doesn't raise error. Instead, Undefined
is outputted.
name: Undefined
4. What is your KCL components version? (Required)
$ kcl version
0.11.2
Note
Discussion on Slack: https://cloud-native.slack.com/archives/C05TC96NWN8/p1748181426486519
When I add _arg = arg
to the schema User, arg
is validated properly.
schema User[arg: Arg]:
_arg = arg
name: str = "${arg.envName}"
$ kcl hello.k
Error: EvaluationError
--> /Users/shunsukesuzuki/Documents/test/kcl/validation/hello.k:8:1
|
8 | _user = User({})
| attribute 'envName' of Arg is required and can't be None or Undefined
|