diff --git a/libV2/schemaUtils.js b/libV2/schemaUtils.js index 37eab026..ddc63591 100644 --- a/libV2/schemaUtils.js +++ b/libV2/schemaUtils.js @@ -45,6 +45,7 @@ const schemaFaker = require('../assets/json-schema-faker'), 'ipv4', 'ipv6', 'regex', 'uuid', + 'binary', 'json-pointer', 'int64', 'float', @@ -576,15 +577,9 @@ let QUERYPARAM = 'query', return; } - // Set type to binary - if (property.format === 'binary') { - property.type = 'binary'; - } - if ( property.format === 'decimal' || property.format === 'byte' || - property.format === 'binary' || property.format === 'password' || property.format === 'unix-time' ) { @@ -848,7 +843,6 @@ let QUERYPARAM = 'query', for (const prop in resolvedSchema.properties) { if (resolvedSchema.properties.hasOwnProperty(prop)) { if ( - resolvedSchema.properties[prop].format === 'binary' || resolvedSchema.properties[prop].format === 'byte' || resolvedSchema.properties[prop].format === 'decimal' ) { @@ -1363,7 +1357,6 @@ let QUERYPARAM = 'query', } if ( - requestBodySchema.properties[prop].format === 'binary' || requestBodySchema.properties[prop].format === 'byte' || requestBodySchema.properties[prop].format === 'decimal' ) { @@ -1523,7 +1516,7 @@ let QUERYPARAM = 'query', // TODO: Add handling for headers from encoding - if (paramSchema && paramSchema.type === 'binary') { + if (paramSchema && paramSchema.type === 'string' && paramSchema.format === 'binary') { param = { key, value: '', diff --git a/libV2/validationUtils.js b/libV2/validationUtils.js index f5f43942..65248fe6 100644 --- a/libV2/validationUtils.js +++ b/libV2/validationUtils.js @@ -85,7 +85,8 @@ schemaFaker.option({ maxItems: 20, // limit on maximum number of items faked for (type: array) useDefaultValue: true, ignoreMissingRefs: true, - avoidExampleItemsLength: true // option to avoid validating type array schema example's minItems and maxItems props. + avoidExampleItemsLength: true, // option to avoid validating type array schema example's minItems and maxItems props. + failOnInvalidFormat: false }); /** diff --git a/test/unit/faker.test.js b/test/unit/faker.test.js index 465e4ae6..4e326c21 100644 --- a/test/unit/faker.test.js +++ b/test/unit/faker.test.js @@ -13,7 +13,8 @@ describe('JSON SCHEMA FAKER TESTS', function () { useDefaultValue: true, useExamplesValue: true, ignoreMissingRefs: true, - avoidExampleItemsLength: false + avoidExampleItemsLength: false, + failOnInvalidFormat: false }); }); @@ -27,7 +28,8 @@ describe('JSON SCHEMA FAKER TESTS', function () { maxItems: 20, useDefaultValue: true, ignoreMissingRefs: true, - avoidExampleItemsLength: true + avoidExampleItemsLength: true, + failOnInvalidFormat: false }); });