Use plain objects for model_cls when building API from spec, use SafeGlobal for testing db