Check with regex.match()
evaluated before "required attribute missing"
#1337
Labels
enhancement
New feature or request
evaluator
runtime
Issues or PRs related to kcl runtime including value and value opertions
Bug Report
When a schema contains a check, using
regex.match(attribute ...)
, this appears to be evaluated before the existence of a non-optional attribute in the instantiated object.If the required attribute is absent, a compiler error is thrown regarding the schema's
check regex.match(attribute)
itself, rather than notification that the user's object is lacking a required attribute. The more obvious error would be raising that the attribute is missing (attribute .. is required and can't be None or Undefined
).As it were, the current error causes a user to debug a problem with the
check
. In my case the missing field was in an inherited schema's object, compounding my confusion.The reproduction will easily illustrate this.
1. Minimal reproduce step (Required)
Playground Link
2. What did you expect to see? (Required)
The missing field should fail with an error before the check dies on the missing
description
variable.3. What did you see instead (Required)
4. What is your KCL components version? (Required)
0.8.7-darwin-arm64
The text was updated successfully, but these errors were encountered: