From 5a44c4a32b928ac44e5e6f6b028310b9c78faf87 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 9 Mar 2021 02:33:28 +0100 Subject: 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. --- util/jsonschema.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util/jsonschema.lua') 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 -- cgit v1.2.3