diff --git a/src/plugins/validation/2and3/semantic-validators/walker-ibm.js b/src/plugins/validation/2and3/semantic-validators/walker-ibm.js index ffc89183d..63776d708 100644 --- a/src/plugins/validation/2and3/semantic-validators/walker-ibm.js +++ b/src/plugins/validation/2and3/semantic-validators/walker-ibm.js @@ -12,6 +12,7 @@ module.exports.validate = function({ jsSpec }, config) { config = config.walker; walk(jsSpec, [], function(obj, path) { + // check for empty descriptions if (obj.description !== undefined && obj.description !== null) { const description = obj.description.toString(); if (description.length === 0 || !description.trim()) { @@ -24,6 +25,16 @@ module.exports.validate = function({ jsSpec }, config) { } } } + + // check for and flag null values - they are not allowed by the spec and are likely mistakes + Object.keys(obj).forEach(key => { + if (obj[key] === null) { + result.error.push({ + path: [...path, key], + message: 'Null values are not allowed for any property.' + }); + } + }); }); return { errors: result.error, warnings: result.warning };