Skip to content

Commit 0423e0a

Browse files
committed
support object response
1 parent afe816e commit 0423e0a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/PerlClientCodegen.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public String getHelp() {
2727

2828
public PerlClientCodegen() {
2929
super();
30-
modelPackage = "/Object";
31-
outputFolder = "generated-code/perl";
30+
modelPackage = File.separatorChar + "Object";
31+
outputFolder = "generated-code" + File.separatorChar + "perl";
3232
modelTemplateFiles.put("object.mustache", ".pm");
3333
apiTemplateFiles.put("api.mustache", ".pm");
3434
templateDir = "perl";
@@ -63,6 +63,7 @@ public PerlClientCodegen() {
6363
languageSpecificPrimitives.add("DateTime");
6464
languageSpecificPrimitives.add("ARRAY");
6565
languageSpecificPrimitives.add("HASH");
66+
languageSpecificPrimitives.add("object");
6667

6768
typeMapping.put("integer", "int");
6869
typeMapping.put("long", "int");
@@ -75,6 +76,7 @@ public PerlClientCodegen() {
7576
typeMapping.put("password", "string");
7677
typeMapping.put("array", "ARRAY");
7778
typeMapping.put("map", "HASH");
79+
typeMapping.put("object", "object");
7880

7981
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/WWW/" + invokerPackage).replace('/', File.separatorChar), "ApiClient.pm"));
8082
supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/WWW/" + invokerPackage).replace('/', File.separatorChar), "Configuration.pm"));

modules/swagger-codegen/src/main/resources/perl/APIClient.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ sub deserialize
216216
$_result = \@_values;
217217
} elsif ($class eq 'DateTime') {
218218
$_result = DateTime->from_epoch(epoch => str2time($data));
219-
} elsif (grep /^$data$/, ('string', 'int', 'float', 'bool')) { #TODO revise the primitive type
219+
} elsif (grep /^$class$/, ('string', 'int', 'float', 'bool', 'object')) { #TODO revise the primitive type
220220
$_result= $data;
221221
} else { # model
222222
my $_instance = use_module("WWW::{{invokerPackage}}::Object::$class")->new;

samples/client/petstore/perl/lib/WWW/SwaggerClient/APIClient.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ sub deserialize
216216
$_result = \@_values;
217217
} elsif ($class eq 'DateTime') {
218218
$_result = DateTime->from_epoch(epoch => str2time($data));
219-
} elsif (grep /^$data$/, ('string', 'int', 'float', 'bool')) { #TODO revise the primitive type
219+
} elsif (grep /^$class$/, ('string', 'int', 'float', 'bool', 'object')) { #TODO revise the primitive type
220220
$_result= $data;
221221
} else { # model
222222
my $_instance = use_module("WWW::SwaggerClient::Object::$class")->new;

0 commit comments

Comments
 (0)