aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_datamapper_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-29 17:57:09 +0100
committerKim Alvefur <zash@zash.se>2021-12-29 17:57:09 +0100
commit5168bd5c5f5cb6cc8e1d294fafd2358081b0e426 (patch)
treecaeaf48201da7a589fbe24b7bfbd21781d1d6acf /spec/util_datamapper_spec.lua
parentcd091bf95ce0e0853edeeb359d3387e06a518427 (diff)
downloadprosody-5168bd5c5f5cb6cc8e1d294fafd2358081b0e426.tar.gz
prosody-5168bd5c5f5cb6cc8e1d294fafd2358081b0e426.zip
util.datamapper: Add support for $ref pointers
Allows reuse of repetitive definitions in schemas.
Diffstat (limited to 'spec/util_datamapper_spec.lua')
-rw-r--r--spec/util_datamapper_spec.lua4
1 files changed, 3 insertions, 1 deletions
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";