Diff

util/jsonschema.lua @ 11441:75a280e6e046

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.
author Kim Alvefur <zash@zash.se>
date Tue, 09 Mar 2021 02:33:28 +0100
parent 11440:d5288c99bb5a
child 11442:95f0d77175ca
line wrap: on
line diff
--- a/util/jsonschema.lua	Tue Mar 09 02:26:05 2021 +0100
+++ b/util/jsonschema.lua	Tue Mar 09 02:33:28 2021 +0100
@@ -57,6 +57,9 @@
 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