cvent / json-schema-deref-sync

Synchronous json schema dereference utility
http://bojand.github.io/json-schema-deref-sync
MIT License
35 stars 24 forks source link

!_.isUndefied(null) throws TypeError: Cannot read property '$ref' of undefined #39

Open sanjulr opened 4 years ago

sanjulr commented 4 years ago

1) What version of the module is the issue happening on? Does the issue happen on latest version? Issue is present in the latest version.

2) What platform and Node.js version? (For example Node.js 0.12 on Mac OS X) 12.13.0 and Mac OS X

3) Sample source code or steps to reproduce openapi-validator-middleware uses this library and when initiating that middleware with a json spec, it throws TypeError: Cannot read property '$ref' of undefined.

The fix is pretty simple. In this library's checkLocalCircular and derefSchema function, change !_.isUndefined(null) to !_.isUndefined(node)

tovbinm commented 3 years ago

We discovered the same problem. Please merge and release the fix.