clarkie / dynogels

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels
Other
490 stars 110 forks source link

Joi conversion from JSON string to Object is not done on Model.update() #90

Closed theiostream closed 6 years ago

theiostream commented 7 years ago

As per the Joi documentation, if we have a schema with a Joi.object() type and we pass a valid JSON string into it, it should convert that JSON string into a JavaScript object.

However, if Dynogels' Model.update() receives an object without all Joi-required keys, it will handle Joi's ValidationError and move on, ignoring all any.required errors and just assuming the object we had passed to the validator originally was decent.

The issue is that if Joi errors out it will not convert that JSON string into a JavaScript object.

clarkie commented 7 years ago

Hi, thanks for reporting this, can you submit a PR with a failing test or your example of it failing?

Thanks

jkav77 commented 6 years ago

I'm going to close this because of no response. We can open it back up if you submit some more details on how it is broken or how to fix it.