added null check for simple definitions with no models

This commit is contained in:
Tony Tam 2015-02-05 16:16:04 -08:00
parent caaa753f58
commit 2ed8e10fe4

View File

@ -71,6 +71,7 @@ public class DefaultGenerator implements Generator {
// models
Map<String, Model> definitions = swagger.getDefinitions();
if(definitions != null) {
for(String name: definitions.keySet()) {
Model model = definitions.get(name);
Map<String, Model> modelMap = new HashMap<String, Model>();
@ -95,6 +96,7 @@ public class DefaultGenerator implements Generator {
writeToFile(filename, tmpl.execute(models));
}
}
}
if(System.getProperty("debugModels") != null) {
System.out.println("############ Model info ############");
Json.prettyPrint(allModels);