Validate nils in object properties correctly
Casting a map to a struct introduces new nils
Code changed to only validate nil values when the field is required.
While this is slightly more lenient, since it allows the API consumer
to explicitly supply a nil where one is not allowed, it makes it
simpler to deal with structs.