Software /
code /
prosody
Changeset
13086:42ea593bfa8d
util.jsonschema: Add some comments wrt Lua-specifics
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 22 Apr 2023 13:30:19 +0200 |
parents | 13085:0e17cb78264f |
children | 13087:5d3e8a226840 |
files | teal-src/prosody/util/jsonschema.tl |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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