Skip to content

Commit

Permalink
Fix validator bug
Browse files Browse the repository at this point in the history
If an optional parameter is presented in validate_all_simple, then the validation loop might breaks before all parameters validated
  • Loading branch information
AMD-NICK committed Dec 8, 2023
1 parent 3cd4214 commit 873e568
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/validator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ local function validate_all_simple(params_rules, params_values)
local formatted_values, errors = {}, {}
for param_name, ruleset in pairs(params_rules) do
local formatted_value, failed_rule_name = validate_value(params_values[param_name], ruleset)
if formatted_value == nil then
if failed_rule_name ~= nil then
errors[param_name] = failed_rule_name
break
else
Expand Down

0 comments on commit 873e568

Please sign in to comment.