fix NPE in get swagger type (#6462)

This commit is contained in:
wing328 2017-09-10 02:16:08 +08:00 committed by GitHub
parent 29bd1d92f2
commit afb75d64d0

View File

@ -555,6 +555,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
public String getSwaggerType(Property p) {
String swaggerType = super.getSwaggerType(p);
String type;
if (swaggerType == null) {
swaggerType = ""; // set swagger type to empty string if null
}
// TODO avoid using toLowerCase as typeMapping should be case-sensitive
if (typeMapping.containsKey(swaggerType.toLowerCase())) {
type = typeMapping.get(swaggerType.toLowerCase());
if (languageSpecificPrimitives.contains(type)) {