`required` property is ignored outside of objects

A schema specifying the property is `required` passes validation even if it is `undefined`.

It is pretty clear from the code that `required` is walked only within `resolveproperties`, which is called only for objects.

This PR only adds a test demonstrating the bug. Unfortunately, the architecture of this module is not documented and I don't feel like I understand it enough to offer a PR that would both fix the problem and be likely to be merged.