יחידה:ParamValidator: הבדלים בין גרסאות בדף

תוכן שנמחק תוכן שנוסף
ביטול גרסה 20275105 של קיפודנחש (שיחה)
לפי הצעת יגאל
שורה 29:
* "empty-required": missing or empty parameter marked as "required" in tempaltedata
* "incompatible": a non-empty parameter passed to the template, incompatible with the parameter type defined in templatedata
* "duplicate": a value is passed for the same parameter (or any of its aliases) more than once
 
 
שורה 195 ⟵ 196:
-- handle undeclared and deprecated
local already_seen = {}
for p_name, value in pairs( t_args ) do
local tp_param, noval, numeric, table_name = td_params[p_name] or all_aliases[p_name], util.empty( value ), tonumber( p_name )
שורה 206 ⟵ 208:
'undeclared' -- tzvototi nishar.
else -- in td: test for depracation and mistype. if deprecated, no further tests
table_name = tp_param.deprecated and not noval and 'deprecated' or
or tp_param.deprecated and noval and 'empty-deprecated' or
or not compatible( tp_param.type, value ) and 'incompatible'
or already_seen[td_param] and 'duplicate'
already_seen[td_param] = true
end
-- report it.