From ff7f0e1d2d063f930f530ae3f4537b66e8af6a3b Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sun, 18 Sep 2022 16:06:12 +0200 Subject: [PATCH] Fix table values constraint in schema validation --- schema.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/schema.lua b/schema.lua index 5bfefb9..e23ca94 100644 --- a/schema.lua +++ b/schema.lua @@ -318,7 +318,11 @@ function load(self, override, params) end assert((not self.list) or modlib.table.count(override) == #override, "list") 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 return override end