From 49d03533cad6527371573c3f474c841ce465b35e Mon Sep 17 00:00:00 2001 From: Aldo Torres Date: Tue, 8 Jul 2025 17:14:20 -0500 Subject: [PATCH] feat: adding additionalProperties property validation --- src/swagger2json/object.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/swagger2json/object.js b/src/swagger2json/object.js index dc15987..9cbe5fb 100644 --- a/src/swagger2json/object.js +++ b/src/swagger2json/object.js @@ -7,9 +7,9 @@ const _ = require('lodash'); module.exports = function() { return function get(swagger,parent){ - if (!swagger.properties){ - require('../utils/error.js')(`There is an object without properties: ${swagger}`); - } + + validationProperties(swagger); + let notInclude = false; if (parent && global.requiredParamsCatch && _.has(swagger, 'required')){ if(!global.configurationFile.minimal_endpoints){ @@ -43,4 +43,13 @@ module.exports = function() { return object; }; + function validationProperties(swagger){ + if(!swagger.properties || Object.keys(swagger.properties).length === 0){ + if(swagger.additionalProperties && swagger.additionalProperties !== false){ + return {} + } + require('../utils/error.js')(`There is an object without properties: ${JSON.stringify(swagger)}`); + } + } + }() \ No newline at end of file