Comparison

teal-src/util/datamapper.tl @ 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
166 local c = s:get_child(name, namespace) 166 local c = s:get_child(name, namespace)
167 if c then 167 if c then
168 out[prop] = parse_object(propschema, c); 168 out[prop] = parse_object(propschema, c);
169 end 169 end
170 elseif proptype == "array" then 170 elseif proptype == "array" then
171 out[prop] = parse_array(propschema, s); 171 local a = parse_array(propschema, s);
172 if a and a[1] ~= nil then
173 out[prop] = a;
174 end
172 else 175 else
173 error "unreachable" 176 error "unreachable"
174 end 177 end
175 elseif value_where == "in_wrapper" and propschema is json_schema_object and proptype == "array" then 178 elseif value_where == "in_wrapper" and propschema is json_schema_object and proptype == "array" then
176 local wrapper = s:get_child(name, namespace); 179 local wrapper = s:get_child(name, namespace);