Commit 75c1683c authored by Boris Kocherov's avatar Boris Kocherov

generate correct schema if discover return empty

parent 358c35c2
......@@ -138,13 +138,9 @@
console.log(error);
})
.push(function (response) {
var arr = [],
row;
if (response && response.numRows > 0) {
schema.properties.dimension = {
title: " ",
oneOf: []
};
var arr = schema.properties.dimension.oneOf,
row;
while (response.hasMoreRows()) {
row = response.readAsObject();
if (row["DIMENSION_TYPE"] !== 2) {
......@@ -158,6 +154,12 @@
response.nextRow();
}
}
if (arr.length !== 0) {
schema.properties.dimension = {
title: " ",
oneOf: arr
};
}
});
}
......@@ -167,13 +169,9 @@
console.log(error);
})
.push(function (response) {
var arr = [],
row;
if (response && response.numRows > 0) {
schema.properties.hierarchy = {
title: " ",
oneOf: []
};
var arr = schema.properties.hierarchy.oneOf,
row;
while (response.hasMoreRows()) {
row = response.readAsObject();
arr.push({
......@@ -183,6 +181,12 @@
response.nextRow();
}
}
if (arr.length !== 0) {
schema.properties.hierarchy = {
title: " ",
oneOf: arr
};
}
});
}
......@@ -192,13 +196,9 @@
console.log(error);
})
.push(function (response) {
var arr = [],
row;
if (response && response.numRows > 0) {
schema.properties.level = {
title: " ",
oneOf: []
};
var arr = schema.properties.level.oneOf,
row;
while (response.hasMoreRows()) {
row = response.readAsObject();
arr.push({
......@@ -208,6 +208,12 @@
response.nextRow();
}
}
if (arr.length !== 0) {
schema.properties.level = {
title: " ",
oneOf: arr
};
}
});
}
......
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