Skip to content
Snippets Groups Projects
Commit 305b6268 authored by 最萌小汐's avatar 最萌小汐
Browse files

update schema

parent 1d90e8d5
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,19 @@ local json = require 'json-beautify' ...@@ -4,6 +4,19 @@ local json = require 'json-beautify'
local configuration = require 'package.configuration' local configuration = require 'package.configuration'
local fsu = require 'fs-utility' local fsu = require 'fs-utility'
local function addSplited(t, key, value)
t[key] = value
local left, right = key:match '([^%.]+)%.(.+)'
if not left then
return
end
local nt = t[left] or {
properties = {}
}
t[left] = nt
addSplited(nt.properties, right, value)
end
local function copyWithNLS(t, callback) local function copyWithNLS(t, callback)
local nt = {} local nt = {}
for k, v in pairs(t) do for k, v in pairs(t) do
...@@ -12,12 +25,14 @@ local function copyWithNLS(t, callback) ...@@ -12,12 +25,14 @@ local function copyWithNLS(t, callback)
elseif type(v) == 'table' then elseif type(v) == 'table' then
v = copyWithNLS(v, callback) v = copyWithNLS(v, callback)
end end
nt[k] = v
if type(k) == 'string' and k:sub(1, #'Lua.') == 'Lua.' then if type(k) == 'string' and k:sub(1, #'Lua.') == 'Lua.' then
nt[k:sub(#'Lua.' + 1)] = { local ref = {
['$ref'] = '#/properties/' .. k ['$ref'] = '#/properties/' .. k
} }
addSplited(nt, k, ref)
addSplited(nt, k:sub(#'Lua.' + 1), ref)
end end
nt[k] = v
end end
return nt return nt
end end
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment