# HG changeset patch # User Kim Alvefur # Date 1616543282 -3600 # Node ID b2f9782497dd6dd2357c7c78cd959a7615625b2c # Parent 0aa2971380e9ffac31d3983779c58c8099f5520f 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. diff -r 0aa2971380e9 -r b2f9782497dd teal-src/util/datamapper.tl --- a/teal-src/util/datamapper.tl Wed Mar 24 00:34:22 2021 +0100 +++ b/teal-src/util/datamapper.tl Wed Mar 24 00:48:02 2021 +0100 @@ -168,7 +168,10 @@ out[prop] = parse_object(propschema, c); end elseif proptype == "array" then - out[prop] = parse_array(propschema, s); + local a = parse_array(propschema, s); + if a and a[1] ~= nil then + out[prop] = a; + end else error "unreachable" end diff -r 0aa2971380e9 -r b2f9782497dd util/datamapper.lua --- a/util/datamapper.lua Wed Mar 24 00:34:22 2021 +0100 +++ b/util/datamapper.lua Wed Mar 24 00:48:02 2021 +0100 @@ -138,7 +138,10 @@ out[prop] = parse_object(propschema, c); end elseif proptype == "array" then - out[prop] = parse_array(propschema, s); + local a = parse_array(propschema, s); + if a and a[1] ~= nil then + out[prop] = a; + end else error("unreachable") end