Commit 499efe61 authored by Jérome Perrin's avatar Jérome Perrin

expandSchema: expand everything from BatchAllInOneEmpty

parent 067afa76
...@@ -400,16 +400,39 @@ ...@@ -400,16 +400,39 @@
// references // references
// XXX this should probably be moved to fieldset ( and not handle // XXX this should probably be moved to fieldset ( and not handle
// class_definition here) // class_definition here)
var referenced, i, var referenced, i, property,
expanded_class_definition = {properties: class_definition = clone(class_definition),
class_definition.properties || {}}; expanded_class_definition = clone(class_definition) || {};
if (!expanded_class_definition.properties) {
expanded_class_definition.properties = {};
}
// expand direct ref // expand direct ref
if (class_definition.$ref) { if (class_definition.$ref) {
referenced = expandSchema(resolveReference(class_definition.$ref, referenced = expandSchema(
resolveReference(
class_definition.$ref,
full_schema.class_definition), full_schema.class_definition),
full_schema); full_schema);
$.extend(expanded_class_definition, referenced); $.extend(expanded_class_definition, referenced);
delete expanded_class_definition.$ref;
}
// expand ref in properties
for (property in class_definition.properties) {
if (class_definition.properties.hasOwnProperty(property)) {
if (class_definition.properties[property].$ref) {
referenced = expandSchema(
resolveReference(
class_definition.properties[property].$ref,
full_schema.class_definition),
full_schema);
//expanded_class_definition.properties[property] = referenced;
$.extend(expanded_class_definition.properties[property], referenced);
delete expanded_class_definition.properties[property].$ref;
}
}
} }
if (class_definition.oneOf) { if (class_definition.oneOf) {
...@@ -431,6 +454,9 @@ ...@@ -431,6 +454,9 @@
} }
$.extend(expanded_class_definition, referenced); $.extend(expanded_class_definition, referenced);
} }
if (expanded_class_definition.allOf) {
delete expanded_class_definition.allOf;
}
} }
if (expanded_class_definition.$ref) { if (expanded_class_definition.$ref) {
delete expanded_class_definition.$ref; delete expanded_class_definition.$ref;
......
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