Allow null title, as in Kubernetes Swagger Spec

This commit is contained in:
Andrew Gibiansky 2016-04-05 12:01:22 -07:00
parent 512e51777d
commit 569d458bc9

View File

@ -181,10 +181,14 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
String title = swagger.getInfo().getTitle(); String title = swagger.getInfo().getTitle();
// Drop any API suffix // Drop any API suffix
if(title == null) {
title = "Swagger";
} else {
title = title.trim(); title = title.trim();
if (title.toUpperCase().endsWith("API")) { if (title.toUpperCase().endsWith("API")) {
title = title.substring(0, title.length() - 3); title = title.substring(0, title.length() - 3);
} }
}
String[] words = title.split(" "); String[] words = title.split(" ");