Support for required fields (incl. spec_from_mongoose_schema)

This contains all the changes from #4 but with the changes from #2 already merged in. It also has some added code to support required fields in `spec_from_mongoose_schema`. So it replaces #4.