# HG changeset patch # User Kim Alvefur # Date 1682163019 -7200 # Node ID 42ea593bfa8ddcbab3596dc920974dc390c17ac9 # Parent 0e17cb78264f1a345482b2e23c62ea2ff74b4f1d util.jsonschema: Add some comments wrt Lua-specifics diff -r 0e17cb78264f -r 42ea593bfa8d 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