Software /
code /
prosody
Comparison
util/datamapper.lua @ 11481:b2f9782497dd
util.datamapper: Don't include empty unwrapped arrays
Since there is no way to distinguish an empty such array from a
zero-length array. Dropping it seems like the least annoying thing to
do.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 24 Mar 2021 00:48:02 +0100 |
parent | 11479:377a9eaf7bef |
child | 12133:11060c8919b6 |
comparison
equal
deleted
inserted
replaced
11480:0aa2971380e9 | 11481:b2f9782497dd |
---|---|
136 local c = s:get_child(name, namespace) | 136 local c = s:get_child(name, namespace) |
137 if c then | 137 if c then |
138 out[prop] = parse_object(propschema, c); | 138 out[prop] = parse_object(propschema, c); |
139 end | 139 end |
140 elseif proptype == "array" then | 140 elseif proptype == "array" then |
141 out[prop] = parse_array(propschema, s); | 141 local a = parse_array(propschema, s); |
142 if a and a[1] ~= nil then | |
143 out[prop] = a; | |
144 end | |
142 else | 145 else |
143 error("unreachable") | 146 error("unreachable") |
144 end | 147 end |
145 elseif value_where == "in_wrapper" and type(propschema) == "table" and proptype == "array" then | 148 elseif value_where == "in_wrapper" and type(propschema) == "table" and proptype == "array" then |
146 local wrapper = s:get_child(name, namespace); | 149 local wrapper = s:get_child(name, namespace); |