Mercurial > prosody-modules
diff mod_rest/jsonmap.lib.lua @ 3886:b64b08b7bf8e
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 07 Feb 2020 20:53:57 +0100 |
parents | 1ec45dbc7db5 |
children | 04ea96a0488d |
line wrap: on
line diff
--- 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