From d78a32f136f4dc1d4c6fc839f43b93f98eae72fd Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 22 Apr 2023 13:30:19 +0200 Subject: util.jsonschema: Add some comments wrt Lua-specifics --- teal-src/prosody/util/jsonschema.tl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'teal-src/prosody') diff --git a/teal-src/prosody/util/jsonschema.tl b/teal-src/prosody/util/jsonschema.tl index 8acb1309..16099e76 100644 --- a/teal-src/prosody/util/jsonschema.tl +++ b/teal-src/prosody/util/jsonschema.tl @@ -309,6 +309,9 @@ function complex_validate (schema : json_schema_object, data : any, root : json_ 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 @@ function complex_validate (schema : json_schema_object, data : any, root : json_ 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 -- cgit v1.2.3