aboutsummaryrefslogtreecommitdiffstats
path: root/util/jsonschema.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-09 02:33:28 +0100
committerKim Alvefur <zash@zash.se>2021-03-09 02:33:28 +0100
commit5a44c4a32b928ac44e5e6f6b028310b9c78faf87 (patch)
tree01350fccc2331aa753e6357781af16c51604b17c /util/jsonschema.lua
parent6a7346ac8e06ff00ba016141ccda99b4af83347e (diff)
downloadprosody-5a44c4a32b928ac44e5e6f6b028310b9c78faf87.tar.gz
prosody-5a44c4a32b928ac44e5e6f6b028310b9c78faf87.zip
util.jsonschema: Allow a boolean as schema
Apparently a schema must be either an object or a boolean. Not sure where I got this string shortcut from, but I think I will keep it as it is very convenient.
Diffstat (limited to 'util/jsonschema.lua')
-rw-r--r--util/jsonschema.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/jsonschema.lua b/util/jsonschema.lua
index 23a47bd7..b285feb4 100644
--- a/util/jsonschema.lua
+++ b/util/jsonschema.lua
@@ -57,6 +57,9 @@ end
type_validators.integer = type_validators.number
local function validate(schema, data)
+ if type(schema) == "boolean" then
+ return schema
+ end
if type(schema) == "string" then
return simple_validate(schema, data)
end