From 5168bd5c5f5cb6cc8e1d294fafd2358081b0e426 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 29 Dec 2021 17:57:09 +0100 Subject: util.datamapper: Add support for $ref pointers Allows reuse of repetitive definitions in schemas. --- spec/util_datamapper_spec.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/util_datamapper_spec.lua') diff --git a/spec/util_datamapper_spec.lua b/spec/util_datamapper_spec.lua index 039475f5..0dcce7e0 100644 --- a/spec/util_datamapper_spec.lua +++ b/spec/util_datamapper_spec.lua @@ -15,8 +15,9 @@ describe("util.datampper", function() setup(function() -- a convenience function for simple attributes, there's a few of them - local function attr() return {type = "string"; xml = {attribute = true}} end + local function attr() return {["$ref"]="#/$defs/attr"} end s = { + ["$defs"] = { attr = { type = "string"; xml = { attribute = true } } }; type = "object"; xml = {name = "message"; namespace = "jabber:client"}; properties = { @@ -111,6 +112,7 @@ describe("util.datampper", function() }; disco_schema = { + ["$defs"] = { attr = { type = "string"; xml = { attribute = true } } }; type = "object"; xml = { name = "iq"; -- cgit v1.2.3