Closed LinYunling closed 1 week ago
You can use the check if filter.
import regex
schema testModel:
name: str
version?: str
check:
regex.match(name, r"^[a-z_]{1,62}$")
regex.match(version, r"^\d{1,3}.\d{1,3}.\d{1,3}$") if version
test = testModel {
name = "abc"
version = "1.0.0"
}
thanks
Code:
kcl run, report the error:![image](https://github.com/kcl-lang/kcl/assets/14899416/50f22d0d-37ba-4590-812c-ac2ba33eb6e4)
if I define the verison in test, everything is ok So how to check the optional attribute thanks