fix casting issue with ModelImpl in Haskell

This commit is contained in:
wing328
2016-07-27 18:07:35 +08:00
parent c23b473636
commit 3cd37bf5e9
5 changed files with 404 additions and 3 deletions

View File

@@ -471,6 +471,11 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
// Create newtypes for things with non-object types
String dataOrNewtype = "data";
// check if it's a ModelImpl before casting
if (!(mod instanceof ModelImpl)) {
return model;
}
String modelType = ((ModelImpl) mod).getType();
if(modelType != "object" && typeMapping.containsKey(modelType)) {
String newtype = typeMapping.get(modelType);