Commit e1cefbfd authored by Boris Kocherov's avatar Boris Kocherov

set empty object/array for required properties/items

parent 9cec5e6f
......@@ -1071,6 +1071,9 @@
div.setAttribute("data-parent-scope", gadget.element.getAttribute("data-gadget-scope"));
div.setAttribute("data-json-path", first_path + '/');
div.setAttribute("data-json-type", type);
if (options.required) {
div.setAttribute("data-json-required", "true");
}
}
if (schema.info !== undefined) {
......@@ -1549,12 +1552,19 @@
}
// set empty object if default value require this
// set empty object/array for required properties/items
array = g.element
.querySelectorAll("div[data-parent-scope='" +
g.element.getAttribute("data-gadget-scope") + "']");
for (i = 0; i < array.length; i += 1) {
path = array[i].getAttribute("data-json-path").slice(0, -1);
if (array[i].hasAttribute("data-json-required")) {
if (array[i].getAttribute("data-json-type") === "object") {
convertOnMultiLevel(multi_level_dict, path, {});
} else {
convertOnMultiLevel(multi_level_dict, path, []);
}
}
}
for (path in options.arrays) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment