Merge pull request #855 from geekerzp/develop_2.0_python_deserialize_map

[Python] bug fix for map response
This commit is contained in:
Tony Tam
2015-06-17 08:26:58 -07:00
9 changed files with 98 additions and 9 deletions

View File

@@ -46,10 +46,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
typeMapping.put("long", "int");
typeMapping.put("double", "float");
typeMapping.put("array", "list");
typeMapping.put("map", "map");
typeMapping.put("map", "dict");
typeMapping.put("boolean", "bool");
typeMapping.put("string", "str");
typeMapping.put("date", "datetime");
typeMapping.put("object", "object");
// from https://docs.python.org/release/2.5.4/ref/keywords.html
reservedWords = new HashSet<String>(
@@ -111,7 +112,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
MapProperty mp = (MapProperty) p;
Property inner = mp.getAdditionalProperties();
return getSwaggerType(p) + "(String, " + getTypeDeclaration(inner) + ")";
return getSwaggerType(p) + "(str, " + getTypeDeclaration(inner) + ")";
}
return super.getTypeDeclaration(p);
}