forked from loafle/openapi-generator-original
support object response
This commit is contained in:
parent
afe816efb6
commit
0423e0a2df
@ -27,8 +27,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
public PerlClientCodegen() {
|
public PerlClientCodegen() {
|
||||||
super();
|
super();
|
||||||
modelPackage = "/Object";
|
modelPackage = File.separatorChar + "Object";
|
||||||
outputFolder = "generated-code/perl";
|
outputFolder = "generated-code" + File.separatorChar + "perl";
|
||||||
modelTemplateFiles.put("object.mustache", ".pm");
|
modelTemplateFiles.put("object.mustache", ".pm");
|
||||||
apiTemplateFiles.put("api.mustache", ".pm");
|
apiTemplateFiles.put("api.mustache", ".pm");
|
||||||
templateDir = "perl";
|
templateDir = "perl";
|
||||||
@ -63,6 +63,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
languageSpecificPrimitives.add("DateTime");
|
languageSpecificPrimitives.add("DateTime");
|
||||||
languageSpecificPrimitives.add("ARRAY");
|
languageSpecificPrimitives.add("ARRAY");
|
||||||
languageSpecificPrimitives.add("HASH");
|
languageSpecificPrimitives.add("HASH");
|
||||||
|
languageSpecificPrimitives.add("object");
|
||||||
|
|
||||||
typeMapping.put("integer", "int");
|
typeMapping.put("integer", "int");
|
||||||
typeMapping.put("long", "int");
|
typeMapping.put("long", "int");
|
||||||
@ -75,6 +76,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.put("password", "string");
|
typeMapping.put("password", "string");
|
||||||
typeMapping.put("array", "ARRAY");
|
typeMapping.put("array", "ARRAY");
|
||||||
typeMapping.put("map", "HASH");
|
typeMapping.put("map", "HASH");
|
||||||
|
typeMapping.put("object", "object");
|
||||||
|
|
||||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/WWW/" + invokerPackage).replace('/', File.separatorChar), "ApiClient.pm"));
|
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/WWW/" + invokerPackage).replace('/', File.separatorChar), "ApiClient.pm"));
|
||||||
supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/WWW/" + invokerPackage).replace('/', File.separatorChar), "Configuration.pm"));
|
supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/WWW/" + invokerPackage).replace('/', File.separatorChar), "Configuration.pm"));
|
||||||
|
@ -216,7 +216,7 @@ sub deserialize
|
|||||||
$_result = \@_values;
|
$_result = \@_values;
|
||||||
} elsif ($class eq 'DateTime') {
|
} elsif ($class eq 'DateTime') {
|
||||||
$_result = DateTime->from_epoch(epoch => str2time($data));
|
$_result = DateTime->from_epoch(epoch => str2time($data));
|
||||||
} elsif (grep /^$data$/, ('string', 'int', 'float', 'bool')) { #TODO revise the primitive type
|
} elsif (grep /^$class$/, ('string', 'int', 'float', 'bool', 'object')) { #TODO revise the primitive type
|
||||||
$_result= $data;
|
$_result= $data;
|
||||||
} else { # model
|
} else { # model
|
||||||
my $_instance = use_module("WWW::{{invokerPackage}}::Object::$class")->new;
|
my $_instance = use_module("WWW::{{invokerPackage}}::Object::$class")->new;
|
||||||
|
@ -216,7 +216,7 @@ sub deserialize
|
|||||||
$_result = \@_values;
|
$_result = \@_values;
|
||||||
} elsif ($class eq 'DateTime') {
|
} elsif ($class eq 'DateTime') {
|
||||||
$_result = DateTime->from_epoch(epoch => str2time($data));
|
$_result = DateTime->from_epoch(epoch => str2time($data));
|
||||||
} elsif (grep /^$data$/, ('string', 'int', 'float', 'bool')) { #TODO revise the primitive type
|
} elsif (grep /^$class$/, ('string', 'int', 'float', 'bool', 'object')) { #TODO revise the primitive type
|
||||||
$_result= $data;
|
$_result= $data;
|
||||||
} else { # model
|
} else { # model
|
||||||
my $_instance = use_module("WWW::SwaggerClient::Object::$class")->new;
|
my $_instance = use_module("WWW::SwaggerClient::Object::$class")->new;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user