Commit d6a7ebde authored by Boris Kocherov's avatar Boris Kocherov

support oneOf

parent af5b3f95
......@@ -443,6 +443,7 @@
break;
case "allOf":
case "anyOf":
case "oneOf":
case "$ref":
case "id":
case "$id":
......@@ -456,6 +457,7 @@
switch (key) {
case "allOf":
case "anyOf":
case "oneOf":
case "$ref":
break;
default:
......@@ -473,7 +475,7 @@
var i,
arr = [];
for (i = 0; i < schema_array.length; i += 1) {
arr.push(expandSchema(g, schema_array[i], schema_path + '/allOf/' + i.toString()));
arr.push(expandSchema(g, schema_array[i], schema_path + '/' + i.toString()));
}
return RSVP.all(arr);
})
......@@ -507,14 +509,13 @@
});
}
function anyOf(g, schema, schema_path) {
var schema_array = schema.anyOf;
function anyOf(g, schema_array, schema_path, base_schema) {
return RSVP.Queue()
.push(function () {
var i,
arr = [];
for (i = 0; i < schema_array.length; i += 1) {
arr.push(expandSchema(g, mergeSchemas(schema_array[i], schema), schema_path + '/anyOf/' + i.toString()));
arr.push(expandSchema(g, mergeSchemas(schema_array[i], base_schema), schema_path + '/' + i.toString()));
}
return RSVP.all(arr);
})
......@@ -544,10 +545,13 @@
schema = true;
}
if (schema.anyOf !== undefined) {
return anyOf(g, schema, schema_path);
return anyOf(g, schema.anyOf, schema_path + '/anyOf', schema);
}
if (schema.oneOf !== undefined) {
return anyOf(g, schema.oneOf, schema_path + '/oneOf', schema);
}
if (schema.allOf !== undefined) {
return allOf(g, schema.allOf, schema_path, schema);
return allOf(g, schema.allOf, schema_path + '/allOf', schema);
}
if (schema.$ref) {
return loadJSONSchema(g, schema.$ref, schema_path);
......
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