Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nulls are returned instead of empty strings #138

Open
ghost opened this issue Aug 14, 2019 · 1 comment
Open

Nulls are returned instead of empty strings #138

ghost opened this issue Aug 14, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 14, 2019

When new sting elements are added and they are not filled with any data, nulls are returned instead. However it should be empty strings according to the schema.

See the screenshot:

Screen Shot 2019-08-14 at 2 50 09 PM

@peeyush12345
Copy link

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant