Comparison

util/jsonschema.lua @ 12989:dee080c2441e

util.jsonschema: Implement 'dependentSchemas' If this object key exists then this schema must validate against the current object. Seems useful.
author Kim Alvefur <zash@zash.se>
date Sun, 26 Mar 2023 15:20:07 +0200
parent 12988:8592770be63a
child 13084:87f646e353cf
comparison
equal deleted inserted replaced
12988:8592770be63a 12989:dee080c2441e
242 end 242 end
243 end 243 end
244 end 244 end
245 end 245 end
246 246
247 if schema.dependentSchemas then
248 for k, sub in pairs(schema.dependentSchemas) do
249 if data[k] ~= nil and not validate(sub, data, root) then
250 return false
251 end
252 end
253 end
254
247 if schema.uniqueItems then 255 if schema.uniqueItems then
248 256
249 local values = {} 257 local values = {}
250 for _, v in pairs(data) do 258 for _, v in pairs(data) do
251 if values[v] then 259 if values[v] then