lightsofapollo / joi-to-json-schema

140 stars 39 forks source link

Joi.object() should accept all keys #46

Closed Mr4k closed 5 years ago

Mr4k commented 5 years ago

Another odd edge case for joi (tested on v13.0.5). When given no explicit keys or patterns Joi.object() will allow any key even when unknown(false) is specified. Examples:

const schema = Joi.object();
Joi.attempt({ extraKey: 'I am not in the schema' }, schema) // no error this is allowed

const schema = Joi.object().unknown(false);
Joi.attempt({ extraKey: 'I am not in the schema' }, schema) // no error this is also allowed
lightsofapollo commented 5 years ago

LGTM will publish in new version number.

lightsofapollo commented 5 years ago

In 5.0