# HG changeset patch # User Kim Alvefur # Date 1671558947 -3600 # Node ID 74ed772ff5fb691e1b11a000e8f3a2f9c128cbfa # Parent 176fd3ea505c490a8aa0ae1a9e92e98e6bcd7947 util.datamapper: Simplify test schema Don't need the function, more compact to just reference the same reference table. diff -r 176fd3ea505c -r 74ed772ff5fb spec/util_datamapper_spec.lua --- a/spec/util_datamapper_spec.lua Mon Dec 19 23:11:42 2022 +0100 +++ b/spec/util_datamapper_spec.lua Tue Dec 20 18:55:47 2022 +0100 @@ -15,22 +15,22 @@ setup(function() -- a convenience function for simple attributes, there's a few of them - local function attr() return {["$ref"]="#/$defs/attr"} end + local attr = {["$ref"]="#/$defs/attr"}; s = { ["$defs"] = { attr = { type = "string"; xml = { attribute = true } } }; type = "object"; xml = {name = "message"; namespace = "jabber:client"}; properties = { - to = attr(); - from = attr(); - type = attr(); - id = attr(); + to = attr; + from = attr; + type = attr; + id = attr; body = true; -- should be assumed to be a string lang = {type = "string"; xml = {attribute = true; prefix = "xml"}}; delay = { type = "object"; xml = {namespace = "urn:xmpp:delay"; name = "delay"}; - properties = {stamp = attr(); from = attr(); reason = {type = "string"; xml = {text = true}}}; + properties = {stamp = attr; from = attr; reason = {type = "string"; xml = {text = true}}}; }; state = { type = "string"; @@ -66,8 +66,8 @@ xml = {name = "stanza-id"; namespace = "urn:xmpp:sid:0"}; type = "object"; properties = { - id = attr(); - by = attr(); + id = attr; + by = attr; }; }; }; @@ -120,10 +120,10 @@ namespace = "jabber:client" }; properties = { - to = attr(); - from = attr(); - type = attr(); - id = attr(); + to = attr; + from = attr; + type = attr; + id = attr; disco = { type = "object"; xml = {