Nulls are returned instead of empty strings
Opened this issue · 1 comments
Deleted user commented
peeyush12345 commented
function processOptions(parentId, names, data, cb) {
var schemas = {};
var schema = { type: "string" };
if (data[parentId] === "efg") {
schema.title = "efg";
schema.enum = ["", ""];
} else if (data[parentId] === "abc") {
schema.title = "abc";
schema.enum = ["", ""];
}
// Check for null values and convert them to empty strings
var subOptionValue = data[parentId + ".suboption1"];
if (subOptionValue === null) {
subOptionValue = "";
}
schemas["$.sub" + parentId] = schema;
schemas["$.sub" + parentId].default = subOptionValue;
setTimeout(function() {
cb(schemas);
}, 500); // in order to show asynchrony
}