Software /
code /
prosody-modules
Changeset
4525:b68b801ddc50
mod_rest: Restore 'kind' property in JSON-mapped objects
The datamapper schema has no 'kind' field, instead handling it as a
top-level property of the currently unused <xmpp> element and doing this
early dispatch on the top level element name.
This puts the field back into the output JSON.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 23 Mar 2021 17:44:49 +0100 |
parents | 4524:9764d27db681 |
children | 4526:23b681214be3 |
files | mod_rest/jsonmap.lib.lua |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua Tue Mar 23 15:24:47 2021 +0100 +++ b/mod_rest/jsonmap.lib.lua Tue Mar 23 17:44:49 2021 +0100 @@ -408,6 +408,8 @@ local function st2json(s) local t = map.parse(schema.properties[s.name], s); + t.kind = s.name; + if s.name == "presence" and not s.attr.type then t.type = "available"; end