Commit 165e5f7a authored by Boris Kocherov's avatar Boris Kocherov

render patternProperties selector for every pattern and disable rendering

additionalProperty selector if exist ".*" "^.*$" ".*$" "^.* patterns
parent 200b786a
...@@ -1225,6 +1225,7 @@ ...@@ -1225,6 +1225,7 @@
if (properties.hasOwnProperty(key)) { if (properties.hasOwnProperty(key)) {
schema_arr = properties[key]; schema_arr = properties[key];
s_o = schemaArrFilteredByDocument(schema_arr, default_dict[key]); s_o = schemaArrFilteredByDocument(schema_arr, default_dict[key]);
// XXX need schema merge with patternProperties passed key
if (checkSchemaArrOneChoise(schema_arr)) { if (checkSchemaArrOneChoise(schema_arr)) {
if (required.indexOf(key) >= 0) { if (required.indexOf(key) >= 0) {
used_properties[key] = false; used_properties[key] = false;
...@@ -1315,30 +1316,44 @@ ...@@ -1315,30 +1316,44 @@
}) })
.push(function () { .push(function () {
var queue = RSVP.Queue(), var queue = RSVP.Queue(),
key,
additionalProperties; additionalProperties;
// XXX for pattern properties needs schemas merge for
// all passed patterns
if (json_field.patternProperties !== undefined) { if (json_field.patternProperties !== undefined) {
// XXX need loop on any pattern properties for (key in json_field.patternProperties) {
if (json_field.patternProperties['.*'] !== undefined) { if (json_field.patternProperties.hasOwnProperty(key)) {
queue if (key === ".*" ||
.push(render_object_additionalProperty.bind(g, key === "^.*$" ||
key === ".*$" ||
key === "^.*"
) {
// additionalProperties nether used in this case
additionalProperties = false;
}
queue
.push(render_object_additionalProperty.bind(g,
g, g,
".* property", key + " property",
default_dict, default_dict,
path, path,
json_field.patternProperties['.*'], json_field.patternProperties[key],
schema_path + '/patternProperties/.*', schema_path + '/patternProperties/' + key,
used_properties, used_properties,
element_append element_append
)) ))
.push(root_append); .push(root_append);
}
} }
} }
if (json_field.additionalProperties === undefined) { if (additionalProperties === undefined) {
additionalProperties = true; if (json_field.additionalProperties === undefined) {
} else { additionalProperties = true;
additionalProperties = json_field.additionalProperties; } else {
additionalProperties = json_field.additionalProperties;
}
} }
if (additionalProperties !== false) { if (additionalProperties !== false) {
queue queue
......
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