Skip to content

Commit 305b626

Browse files
committed
update schema
1 parent 1d90e8d commit 305b626

File tree

3 files changed

+1101
-2
lines changed

3 files changed

+1101
-2
lines changed

setting/build.lua

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ local json = require 'json-beautify'
44
local configuration = require 'package.configuration'
55
local fsu = require 'fs-utility'
66

7+
local function addSplited(t, key, value)
8+
t[key] = value
9+
local left, right = key:match '([^%.]+)%.(.+)'
10+
if not left then
11+
return
12+
end
13+
local nt = t[left] or {
14+
properties = {}
15+
}
16+
t[left] = nt
17+
addSplited(nt.properties, right, value)
18+
end
19+
720
local function copyWithNLS(t, callback)
821
local nt = {}
922
for k, v in pairs(t) do
@@ -12,12 +25,14 @@ local function copyWithNLS(t, callback)
1225
elseif type(v) == 'table' then
1326
v = copyWithNLS(v, callback)
1427
end
15-
nt[k] = v
1628
if type(k) == 'string' and k:sub(1, #'Lua.') == 'Lua.' then
17-
nt[k:sub(#'Lua.' + 1)] = {
29+
local ref = {
1830
['$ref'] = '#/properties/' .. k
1931
}
32+
addSplited(nt, k, ref)
33+
addSplited(nt, k:sub(#'Lua.' + 1), ref)
2034
end
35+
nt[k] = v
2136
end
2237
return nt
2338
end

0 commit comments

Comments
 (0)