Collection/keyed collection conformance

Instead of crashing if a value does not meet the requirements to be a valid collection or keyed collection, explicitly test these first and fail validation using an appropriate error code. This is particularly important if we want to use a compound validator that allows an object either to be a collection or a keyed collection. Before, this would simply cause a crash. With these changes, things should work.