# HG changeset patch # User Kim Alvefur # Date 1581105237 -3600 # Node ID b64b08b7bf8ed73908161846743f312cb81a47d8 # Parent 1ec45dbc7db58a29b487699c6d536f95d67bc1b0 mod_rest: Ignore already handled top-level stanza attr fields Prevents the check in 1ec45dbc7db5 from returning an error for these fields that aren't handled in that loop. diff -r 1ec45dbc7db5 -r b64b08b7bf8e mod_rest/jsonmap.lib.lua --- a/mod_rest/jsonmap.lib.lua Fri Feb 07 20:49:07 2020 +0100 +++ b/mod_rest/jsonmap.lib.lua Fri Feb 07 20:53:57 2020 +0100 @@ -90,6 +90,14 @@ }; local simple_types = { + -- top level stanza attributes + -- needed here to mark them as known fields + kind = "attr", + type = "attr", + to = "attr", + from = "attr", + id = "attr", + -- basic message body = "text_tag", subject = "text_tag", @@ -453,6 +461,8 @@ if typ then if typ == "text_tag" then s:text_tag(k, v); + elseif typ == "attr" then -- luacheck: ignore 542 + -- handled already elseif typ[1] == "text_tag" then s:text_tag(typ[3] or k, v, typ[2] and { xmlns = typ[2] }); elseif typ[1] == "name" then