util.jsonschema: Add some comments wrt Lua-specifics
authorKim Alvefur <zash@zash.se>
Sat, 22 Apr 2023 13:30:19 +0200
changeset 13090 42ea593bfa8d
parent 13089 0e17cb78264f
child 13091 5d3e8a226840
util.jsonschema: Add some comments wrt Lua-specifics
teal-src/prosody/util/jsonschema.tl
--- a/teal-src/prosody/util/jsonschema.tl	Sat Apr 22 12:48:51 2023 +0200
+++ b/teal-src/prosody/util/jsonschema.tl	Sat Apr 22 13:30:19 2023 +0200
@@ -309,6 +309,9 @@
 	end
 
 	if data is table then
+		-- tables combine object and array behavior, thus we do both kinds of
+		-- validations in this block, which could be useful for validating Lua
+		-- tables
 
 		if schema.maxItems and #data > schema.maxItems then
 			return false
@@ -339,6 +342,7 @@
 		end
 
 		if schema.propertyNames ~= nil then
+			-- could be used to validate non-string keys of Lua tables
 			for k in pairs(data) do
 				if not validate(schema.propertyNames, k, root) then
 					return false