diff --git a/xls2ddl/tmpls.py b/xls2ddl/tmpls.py index 10c3450..2f51ef1 100644 --- a/xls2ddl/tmpls.py +++ b/xls2ddl/tmpls.py @@ -374,12 +374,12 @@ _validation_rules = json.loads(r'''{{validation_rules}}''') import re as _re _errors = [] for _fname, _rules in _validation_rules.items(): -\t_val = params_kw.get(_fname, '') -\tif _val is None: _val = '' -\t_val = str(_val) -\t# Update: skip validation if field is empty (not modified) -\tif not _val or _val.strip() == '': +\tif _fname not in params_kw: \t\tcontinue +\t_val = params_kw.get(_fname) +\tif _val is None or str(_val).strip() == '': +\t\tcontinue +\t_val = str(_val) \tfor _rule in _rules: \t\t_rt = _rule.get('type', '') \t\t_rm = _rule.get('message', _fname)