updated script, addressed #189 with type mapping

This commit is contained in:
Tony Tam 2015-02-15 18:06:40 -08:00
parent dfc7750dda
commit db5259b913

View File

@ -18,7 +18,10 @@ package com.wordnik.swagger.codegen.languages;
import com.wordnik.swagger.codegen.*;
import com.wordnik.swagger.models.properties.*;
import java.io.File;
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
String module = "client";
public String getName() {
return "python";
@ -35,8 +38,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
apiTemplateFiles.put("api.mustache", ".py");
templateDir = "python";
apiPackage = "";
modelPackage = "models";
apiPackage = module;
modelPackage = module + ".models";
languageSpecificPrimitives.clear();
languageSpecificPrimitives.add("int");
@ -59,10 +62,9 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
typeMapping.put("date", "datetime");
supportingFiles.add(new SupportingFile("swagger.mustache", "", "swagger.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", "", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", modelPackage, "__init__.py"));
supportingFiles.add(new SupportingFile("swagger.mustache", module, "swagger.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", module, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", modelPackage.replaceAll("\\.", File.separator), "__init__.py"));
}
@Override