Fix table values constraint in schema validation

This commit is contained in:
Lars Mueller 2022-09-18 16:06:12 +02:00
parent d2183f2357
commit ff7f0e1d2d

@ -318,7 +318,11 @@ function load(self, override, params)
end end
assert((not self.list) or modlib.table.count(override) == #override, "list") assert((not self.list) or modlib.table.count(override) == #override, "list")
end end
assert((not self.values) or self.values[override], "values") -- Apply the values check only for primitive types where table indexing is by value;
-- the `values` field has a different meaning for tables (constraint all values must fulfill)
if self.type ~= "table" then
assert((not self.values) or self.values[override], "values")
end
if self.func then self.func(override) end if self.func then self.func(override) end
return override return override
end end