@@ -170,6 +170,9 @@ function checkValueEqualsDefault(value, definedDefault) {
170
170
* @returns {Boolean } the value is the representation of its type
171
171
*/
172
172
function isTypeValue ( value , schema ) {
173
+ if ( ! _ . isObject ( schema ) ) {
174
+ return false ;
175
+ }
173
176
if ( schema . hasOwnProperty ( 'type' ) && schema . hasOwnProperty ( 'default' ) ) {
174
177
const isDefault = checkValueEqualsDefault ( value , schema . default ) ;
175
178
if ( isDefault ) {
@@ -194,7 +197,7 @@ function isTypeValue(value, schema) {
194
197
* @returns {Boolean } the value is the representation of its type
195
198
*/
196
199
function checkIsCorrectType ( value , schema ) {
197
- if ( schema . hasOwnProperty ( 'type' ) &&
200
+ if ( _ . has ( schema , 'type' ) &&
198
201
typeof schemaTypeToJsValidator [ schema . type ] === 'function' ) {
199
202
const isCorrectType = schemaTypeToJsValidator [ schema . type ] ( value ) ;
200
203
if ( isCorrectType ) {
@@ -272,10 +275,10 @@ module.exports = {
272
275
} ,
273
276
274
277
handleExclusiveMaximum : function ( schema , max ) {
275
- max = schema . hasOwnProperty ( 'maximum' ) ?
278
+ max = _ . has ( schema , 'maximum' ) ?
276
279
schema . maximum :
277
280
max ;
278
- if ( schema . hasOwnProperty ( 'exclusiveMaximum' ) ) {
281
+ if ( _ . has ( schema , 'exclusiveMaximum' ) ) {
279
282
if ( typeof schema . exclusiveMaximum === 'boolean' ) {
280
283
return schema . multipleOf ?
281
284
max - schema . multipleOf :
@@ -291,10 +294,10 @@ module.exports = {
291
294
} ,
292
295
293
296
handleExclusiveMinimum : function ( schema , min ) {
294
- min = schema . hasOwnProperty ( 'minimum' ) ?
297
+ min = _ . has ( schema , 'minimum' ) ?
295
298
schema . minimum :
296
299
min ;
297
- if ( schema . hasOwnProperty ( 'exclusiveMinimum' ) ) {
300
+ if ( _ . has ( schema , 'exclusiveMinimum' ) ) {
298
301
if ( typeof schema . exclusiveMinimum === 'boolean' ) {
299
302
return schema . multipleOf ?
300
303
min + schema . multipleOf :
@@ -349,7 +352,7 @@ module.exports = {
349
352
350
353
getServersPathVars : function ( servers ) {
351
354
return servers . reduce ( ( acc , current ) => {
352
- const newVarNames = current . hasOwnProperty ( 'variables' ) ?
355
+ const newVarNames = _ . has ( current , 'variables' ) ?
353
356
Object . keys ( current . variables ) . filter ( ( varName ) => {
354
357
return ! acc . includes ( varName ) ;
355
358
} ) :
0 commit comments