diff options
author | Kim Alvefur <zash@zash.se> | 2023-04-22 13:30:19 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-04-22 13:30:19 +0200 |
commit | d78a32f136f4dc1d4c6fc839f43b93f98eae72fd (patch) | |
tree | 2b8bf7a01c39d94b82f9acf716f7c9e68bd00c60 /teal-src | |
parent | 9c7c94ab73eb1e9fe78fc022805a06be0579d4b9 (diff) | |
download | prosody-d78a32f136f4dc1d4c6fc839f43b93f98eae72fd.tar.gz prosody-d78a32f136f4dc1d4c6fc839f43b93f98eae72fd.zip |
util.jsonschema: Add some comments wrt Lua-specifics
Diffstat (limited to 'teal-src')
-rw-r--r-- | teal-src/prosody/util/jsonschema.tl | 4 |
1 files changed, 4 insertions, 0 deletions
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 |