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 defaults = require('json-schema-defaults');
var default_json = defaults(validate.schema); // <~ cannot set default value to $ref properties
_.defaultsDeep(payload, default_json);
Ah, interesting, thanks. I will look at this package... I though to do it after async validation but I will do it before. Without catering for edge-cases that are not that important it's pretty easy actually. And it will be much faster, as it will be compiled into the validating function.
Closing this one now, feel free to post to #42 if you have any questions
Does ajv have an option to apply default value from schema to input json if the property is not exist?
It would be nice to have feature.
The text was updated successfully, but these errors were encountered: