Commit 033e144f authored by Boris Kocherov's avatar Boris Kocherov

copy of schema_part saved in shared expanded schema object and fix checkCircular() for support this

parent 53ba19bf
...@@ -35,9 +35,14 @@ ...@@ -35,9 +35,14 @@
function checkCircular(g, path, url) { function checkCircular(g, path, url) {
var required_stack, var required_stack,
idx,
prev_field_path = getMaxPathInDict(g.props.schema_required_urls, path); prev_field_path = getMaxPathInDict(g.props.schema_required_urls, path);
required_stack = g.props.schema_required_urls[prev_field_path] || []; required_stack = g.props.schema_required_urls[prev_field_path] || [];
if (required_stack.indexOf(url) >= 0) { idx = required_stack.indexOf(url);
if (idx >= 0) {
if (path === prev_field_path && idx === 0) {
return;
}
throw new Error("Circular reference detected"); throw new Error("Circular reference detected");
} }
g.props.schema_required_urls[path] = [url].concat(required_stack); g.props.schema_required_urls[path] = [url].concat(required_stack);
...@@ -212,7 +217,7 @@ ...@@ -212,7 +217,7 @@
// otherwise we have issue in convertToRealWorldSchemaPath // otherwise we have issue in convertToRealWorldSchemaPath
g.props.schema_map[path] = url; g.props.schema_map[path] = url;
} }
schemaPushSchemaPart(g.props.schema, path, schema_part); schemaPushSchemaPart(g.props.schema, path, JSON.parse(JSON.stringify(schema_part)));
// console.log(g.props.schema[""]); // console.log(g.props.schema[""]);
return schema_part; return schema_part;
}); });
......
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