Diff

util/jsonschema.lua @ 13872:76582d10bc09 default tip

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 05 May 2025 17:30:06 +0200
parent 13866:7f6916088278
parent 13867:eabd38507c1d
line wrap: on
line diff
--- a/util/jsonschema.lua	Mon May 05 17:14:57 2025 +0200
+++ b/util/jsonschema.lua	Mon May 05 17:30:06 2025 +0200
@@ -184,7 +184,7 @@
 		end
 	end
 
-	if schema["not"] then
+	if schema["not"] ~= nil then
 		if validate(schema["not"], data, root, sloc .. "/not", iloc, errs) then
 			table.insert(errs, mkerr(sloc .. "/not", iloc, "did match subschema"))
 			return false, errs
@@ -193,14 +193,14 @@
 
 	if schema["if"] ~= nil then
 		if validate(schema["if"], data, root, sloc .. "/if", iloc, errs) then
-			if schema["then"] then
+			if schema["then"] ~= nil then
 				if not validate(schema["then"], data, root, sloc .. "/then", iloc, errs) then
 					table.insert(errs, mkerr(sloc .. "/then", iloc, "did not match subschema"))
 					return false, errs
 				end
 			end
 		else
-			if schema["else"] then
+			if schema["else"] ~= nil then
 				if not validate(schema["else"], data, root, sloc .. "/else", iloc, errs) then
 					table.insert(errs, mkerr(sloc .. "/else", iloc, "did not match subschema"))
 					return false, errs