Software / code / prosody-modules
Comparison
mod_rest/jsonmap.lib.lua @ 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 |
| parent | 4519:ea1fd703bb27 |
| child | 4731:d71beacaec3b |
comparison
equal
deleted
inserted
replaced
| 4524:9764d27db681 | 4525:b68b801ddc50 |
|---|---|
| 406 } | 406 } |
| 407 | 407 |
| 408 local function st2json(s) | 408 local function st2json(s) |
| 409 local t = map.parse(schema.properties[s.name], s); | 409 local t = map.parse(schema.properties[s.name], s); |
| 410 | 410 |
| 411 t.kind = s.name; | |
| 412 | |
| 411 if s.name == "presence" and not s.attr.type then | 413 if s.name == "presence" and not s.attr.type then |
| 412 t.type = "available"; | 414 t.type = "available"; |
| 413 end | 415 end |
| 414 | 416 |
| 415 if t.to then | 417 if t.to then |