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