Commit cf7bf0b7 authored by Boris Kocherov's avatar Boris Kocherov

`patternProperties` can be mixed with `properties` in `object`

parent 7e8a631e
...@@ -80,7 +80,7 @@ Below is the list of JSON Schema validation properties and current supported sta ...@@ -80,7 +80,7 @@ Below is the list of JSON Schema validation properties and current supported sta
* `patternProperties` * `patternProperties`
- **fixed** values can be only `object` types - **fixed** values can be only `object` types
- add buttons for remove existed `patternProperties` - add buttons for remove existed `patternProperties`
- can not be mixed with `properties` - **fixed** can not be mixed with `properties`
- only regex .* in keys is supported - only regex .* in keys is supported
* `properties` * `properties`
* `required` * `required`
......
...@@ -212,6 +212,18 @@ ...@@ -212,6 +212,18 @@
default_dict = {}; default_dict = {};
} }
for (key in json_field.properties) {
if (json_field.properties.hasOwnProperty(key)) {
default_used_list.push(key);
if (json_field.properties[key].default !== undefined) {
json_field.properties[key].info = '(default = ' + json_field.properties[key].default + ')';
}
queue
.push(render_field.bind(gadget, gadget, key, path,
json_field.properties[key], default_dict[key], root)
);
}
}
if (json_field.patternProperties !== undefined) { if (json_field.patternProperties !== undefined) {
if (json_field.patternProperties['.*'] !== undefined) { if (json_field.patternProperties['.*'] !== undefined) {
...@@ -219,8 +231,6 @@ ...@@ -219,8 +231,6 @@
div.setAttribute("class", "subfield"); div.setAttribute("class", "subfield");
div.title = json_field.description; div.title = json_field.description;
/* console.log(key); */
div_input = document.createElement("div"); div_input = document.createElement("div");
div_input.setAttribute("class", "input"); div_input.setAttribute("class", "input");
...@@ -242,9 +252,8 @@ ...@@ -242,9 +252,8 @@
div.appendChild(div_input); div.appendChild(div_input);
for (key in default_dict) { for (key in default_dict) {
if (default_dict.hasOwnProperty(key)) { if (default_dict.hasOwnProperty(key) && default_used_list.indexOf(key) < 0) {
default_used_list.push(key); default_used_list.push(key);
// div.appendChild(div_input);
queue queue
.push( .push(
addSubForm.bind(gadget, gadget, { addSubForm.bind(gadget, gadget, {
...@@ -261,18 +270,6 @@ ...@@ -261,18 +270,6 @@
} }
} }
for (key in json_field.properties) {
if (json_field.properties.hasOwnProperty(key)) {
default_used_list.push(key);
if (json_field.properties[key].default !== undefined) {
json_field.properties[key].info = '(default = ' + json_field.properties[key].default + ')';
}
queue
.push(render_field.bind(gadget, gadget, key, path,
json_field.properties[key], default_dict[key], root)
);
}
}
for (key in default_dict) { for (key in default_dict) {
if (default_dict.hasOwnProperty(key)) { if (default_dict.hasOwnProperty(key)) {
if (default_used_list.indexOf(key) < 0 ) { if (default_used_list.indexOf(key) < 0 ) {
......
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