Commit 9558b772 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

schema expansion updated, encapsulated references are addressed - durty method

parent ffbf567a
...@@ -583,7 +583,8 @@ ...@@ -583,7 +583,8 @@
function expandProperties(definition, expanded_class_def, fullSchema) { function expandProperties(definition, expanded_class_def, fullSchema) {
console.log("expanding properties"); console.log("expanding properties");
var property, temp1, temp2; console.log(definition);
var property, temp1, temp2, i, subProp, temp3;//, coppy;
for (property in definition.properties) { for (property in definition.properties) {
if (definition.properties.hasOwnProperty(property)) { if (definition.properties.hasOwnProperty(property)) {
console.log("..."); console.log("...");
...@@ -598,11 +599,38 @@ ...@@ -598,11 +599,38 @@
definition.properties[property], fullSchema definition.properties[property], fullSchema
); );
console.log("there is a referenced property # #"); console.log("there is a referenced property # #");
console.log(property);
expanded_class_def.properties[property] expanded_class_def.properties[property]
= temp1; = temp1;
if (temp1.allOf) {
if (temp1.allOf[1].oneOf) {
for (i = 0; i <= temp1.allOf[1].oneOf.length-1; i += 1) {
if (temp1.allOf[1].oneOf[i].properties) {
for (subProp in temp1.allOf[1].oneOf[i].properties) {
if (temp1.allOf[1].oneOf[i]
.properties.hasOwnProperty(subProp)) {
if (temp1.allOf[1].oneOf[i].properties[subProp].$ref) {
console.log("there is referenced sub-property");
console.log(subProp);
temp3
= expandReference(
temp1.allOf[1].oneOf[i].properties[subProp],
fullSchema
);
expanded_class_def.properties[property]
.allOf[1].oneOf[i].properties[subProp]
= temp3;
}
}
}
}
}
}
}
} else { } else {
if (definition.properties[property].properties) { if (definition.properties[property].properties) {
console.log("there is a property property --> recursive"); console.log("there is a property property --> recursive");
console.log(property);
expanded_class_def.properties[property] = {properties: {}}; expanded_class_def.properties[property] = {properties: {}};
temp2 = expandProperties( temp2 = expandProperties(
definition.properties[property], definition.properties[property],
...@@ -611,6 +639,8 @@ ...@@ -611,6 +639,8 @@
); );
definition.properties[property] = temp2; definition.properties[property] = temp2;
} }
console.log("before expanding definition");
console.log(property);
expanded_class_def.properties[property] expanded_class_def.properties[property]
= definition.properties[property]; = definition.properties[property];
} }
......
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