diff mod_rest/jsonmap.lib.lua @ 4841:f69c5a443156

mod_rest: Fix nested message stanzas in XEP-0297 containers It's all a bit awkward because it doesn't normally use the whole schema directly, but rather checks which stanza type is used and picks out that property as a schema. Which also prevents references from working.
author Kim Alvefur <zash@zash.se>
date Wed, 29 Dec 2021 19:40:28 +0100
parents f74c7c518bb2
children 1d231fb827d3
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Wed Dec 29 18:31:40 2021 +0100
+++ b/mod_rest/jsonmap.lib.lua	Wed Dec 29 19:40:28 2021 +0100
@@ -18,7 +18,7 @@
 		end
 		schema.properties.message.properties.archive.properties.forward = schema.properties.message.properties.forwarded;
 		schema.properties.message.properties.forwarded.properties.delay = schema._common.delay;
-		schema.properties.message.properties.forwarded.properties.message.properties = schema.properties.message.properties;
+		schema.properties.message.properties.forwarded.properties.message = schema.properties.message;
 		schema.properties.iq.properties.archive.properties.form = schema._common.dataform;
 		schema.properties.iq.properties.archive.properties.page = schema._common.rsm;
 		schema.properties.iq.properties.result.properties.page = schema._common.rsm;
@@ -536,7 +536,7 @@
 		end
 	end
 
-	local s = map.unparse(schema.properties[kind or "message"], t);
+	local s = map.unparse(schema, { [kind or "message"] = t }).tags[1];
 
 	s.attr.type = t_type;
 	s.attr.to = str(t.to) and jid.prep(t.to);