Software /
code /
prosody
Changeset
11487:b104c10ffce7
util.datamapper: Use attribute convenience function throughout
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Mar 2021 12:53:29 +0100 |
parents | 11486:78d843faaffc |
children | 11488:332c9291f4d5 |
files | spec/util_datamapper_spec.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/spec/util_datamapper_spec.lua Thu Mar 25 15:08:22 2021 +0000 +++ b/spec/util_datamapper_spec.lua Fri Mar 26 12:53:29 2021 +0100 @@ -14,6 +14,7 @@ local disco, disco_info, disco_schema setup(function() + -- a convenience function for simple attributes, there's a few of them local function attr() return {type = "string"; xml = {attribute = true}} end s = { type = "object"; @@ -53,7 +54,7 @@ type = "object"; xml = {namespace = "urn:xmpp:reactions:0"; name = "reactions"}; properties = { - to = {type = "string"; xml = {attribute = true; name = "id"}}; + to = attr(); reactions = {type = "array"; items = {type = "string"; xml = {name = "reaction"}}}; }; }; @@ -63,8 +64,8 @@ xml = {name = "stanza-id"; namespace = "urn:xmpp:sid:0"}; type = "object"; properties = { - id = {xml = {attribute = true}; type = "string"}; - by = {xml = {attribute = true}; type = "string"}; + id = attr(); + by = attr(); }; }; };