You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var paperwork = require('paperwork');
var ScenarioSchemaPatch = {
title: paperwork.optional(String),
text: paperwork.optional(String)
};
var post = { text : "data", unknown_field : "foo"};
paperwork(ScenarioSchemaPatch, post, function (err, validated) {
if (err) {
console.error("Error",err);
} else {
console.log("JSON", validated);
}
});
It returns:
JSON { title: null, text: 'data' }
Why is the title set to null, even if it was set to optional?
The text was updated successfully, but these errors were encountered:
boldt
changed the title
Optional field are null
Optional fields are null
Jul 7, 2015
Imagine the following example:
It returns:
Why is the
title
set to null, even if it was set to optional?The text was updated successfully, but these errors were encountered: