Only validate dataSource when defined

/to @raymondfeng @bajtos 
Please add debug logs for both branches (model is attached to a datasource, model is not attached to any datasource).