mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
update type list in deserialize
This commit is contained in:
parent
1d4735f76d
commit
063a1ffd36
@ -38,7 +38,17 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
reservedWords = new HashSet<String> (
|
reservedWords = new HashSet<String> (
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"__halt_compiler", "abstract", "and", "array", "as", "break", "callable", "case", "catch", "class", "clone", "const", "continue", "declare", "default", "die", "do", "echo", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "eval", "exit", "extends", "final", "for", "foreach", "function", "global", "goto", "if", "implements", "include", "include_once", "instanceof", "insteadof", "interface", "isset", "list", "namespace", "new", "or", "print", "private", "protected", "public", "require", "require_once", "return", "static", "switch", "throw", "trait", "try", "unset", "use", "var", "while", "xor")
|
"else", "lock", "qw",
|
||||||
|
"__END__", "elsif", "lt", "qx",
|
||||||
|
"__FILE__", "eq", "m", "s",
|
||||||
|
"__LINE__", "exp", "ne", "sub",
|
||||||
|
"__PACKAGE__", "for", "no", "tr",
|
||||||
|
"and", "foreach", "or", "unless",
|
||||||
|
"cmp", "ge", "package", "until",
|
||||||
|
"continue", "gt", "q", "while",
|
||||||
|
"CORE", "if", "qq", "xor",
|
||||||
|
"do", "le", "qr", "y"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
additionalProperties.put("invokerPackage", invokerPackage);
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
@ -47,17 +57,25 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
additionalProperties.put("artifactVersion", artifactVersion);
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
|
||||||
languageSpecificPrimitives.add("int");
|
languageSpecificPrimitives.add("int");
|
||||||
languageSpecificPrimitives.add("array");
|
languageSpecificPrimitives.add("Math::BigInt");
|
||||||
languageSpecificPrimitives.add("map");
|
languageSpecificPrimitives.add("double");
|
||||||
languageSpecificPrimitives.add("string");
|
languageSpecificPrimitives.add("string");
|
||||||
|
languageSpecificPrimitives.add("boolean");
|
||||||
languageSpecificPrimitives.add("DateTime");
|
languageSpecificPrimitives.add("DateTime");
|
||||||
|
languageSpecificPrimitives.add("ARRAY");
|
||||||
|
languageSpecificPrimitives.add("HASH");
|
||||||
|
|
||||||
typeMapping.put("long", "int");
|
|
||||||
typeMapping.put("integer", "int");
|
typeMapping.put("integer", "int");
|
||||||
typeMapping.put("Array", "array");
|
typeMapping.put("long", "Math::BigInt");
|
||||||
typeMapping.put("String", "string");
|
typeMapping.put("float", "double");
|
||||||
typeMapping.put("List", "array");
|
typeMapping.put("double", "double");
|
||||||
typeMapping.put("map", "map");
|
typeMapping.put("boolean", "boolean");
|
||||||
|
typeMapping.put("string", "string");
|
||||||
|
typeMapping.put("date", "DateTime");
|
||||||
|
typeMapping.put("dateTime", "DateTime");
|
||||||
|
typeMapping.put("password", "string");
|
||||||
|
typeMapping.put("array", "ARRAY");
|
||||||
|
typeMapping.put("map", "HASH");
|
||||||
|
|
||||||
supportingFiles.add(new SupportingFile("APIClient.mustache", "lib/WWW/" + invokerPackage, "APIClient.pm"));
|
supportingFiles.add(new SupportingFile("APIClient.mustache", "lib/WWW/" + invokerPackage, "APIClient.pm"));
|
||||||
supportingFiles.add(new SupportingFile("BaseObject.mustache", "lib/WWW/" + invokerPackage, "Object/BaseObject.pm"));
|
supportingFiles.add(new SupportingFile("BaseObject.mustache", "lib/WWW/" + invokerPackage, "Object/BaseObject.pm"));
|
||||||
|
@ -65,7 +65,7 @@ sub _deserialize {
|
|||||||
|
|
||||||
if ($type eq 'DateTime') {
|
if ($type eq 'DateTime') {
|
||||||
return DateTime->from_epoch(epoch => str2time($data));
|
return DateTime->from_epoch(epoch => str2time($data));
|
||||||
} elsif ( grep( /^$type$/, ('string', 'int', 'float', 'bool')) ) {
|
} elsif ( grep( /^$type$/, ('int', 'Math::BigInt', 'double', 'string', 'boolean'))) {
|
||||||
return $data;
|
return $data;
|
||||||
} else { # hash(model)
|
} else { # hash(model)
|
||||||
my $_instance = eval "WWW::{{invokerPackage}}::Object::$type->new()";
|
my $_instance = eval "WWW::{{invokerPackage}}::Object::$type->new()";
|
||||||
|
@ -65,7 +65,7 @@ sub _deserialize {
|
|||||||
|
|
||||||
if ($type eq 'DateTime') {
|
if ($type eq 'DateTime') {
|
||||||
return DateTime->from_epoch(epoch => str2time($data));
|
return DateTime->from_epoch(epoch => str2time($data));
|
||||||
} elsif ( grep( /^$type$/, ('string', 'int', 'float', 'bool')) ) {
|
} elsif ( grep( /^$type$/, ('int', 'Math::BigInt', 'double', 'string', 'boolean'))) {
|
||||||
return $data;
|
return $data;
|
||||||
} else { # hash(model)
|
} else { # hash(model)
|
||||||
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
|
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
|
||||||
|
@ -20,7 +20,7 @@ use base "WWW::SwaggerClient::Object::BaseObject";
|
|||||||
#
|
#
|
||||||
|
|
||||||
my $swagger_types = {
|
my $swagger_types = {
|
||||||
'id' => 'int',
|
'id' => 'Math::BigInt',
|
||||||
'name' => 'string'
|
'name' => 'string'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ use base "WWW::SwaggerClient::Object::BaseObject";
|
|||||||
#
|
#
|
||||||
|
|
||||||
my $swagger_types = {
|
my $swagger_types = {
|
||||||
'id' => 'int',
|
'id' => 'Math::BigInt',
|
||||||
'pet_id' => 'int',
|
'pet_id' => 'Math::BigInt',
|
||||||
'quantity' => 'int',
|
'quantity' => 'int',
|
||||||
'ship_date' => 'DateTime',
|
'ship_date' => 'DateTime',
|
||||||
'status' => 'string',
|
'status' => 'string',
|
||||||
|
@ -20,11 +20,11 @@ use base "WWW::SwaggerClient::Object::BaseObject";
|
|||||||
#
|
#
|
||||||
|
|
||||||
my $swagger_types = {
|
my $swagger_types = {
|
||||||
'id' => 'int',
|
'id' => 'Math::BigInt',
|
||||||
'category' => 'Category',
|
'category' => 'Category',
|
||||||
'name' => 'string',
|
'name' => 'string',
|
||||||
'photo_urls' => 'array[string]',
|
'photo_urls' => 'ARRAY[string]',
|
||||||
'tags' => 'array[Tag]',
|
'tags' => 'ARRAY[Tag]',
|
||||||
'status' => 'string'
|
'status' => 'string'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use base "WWW::SwaggerClient::Object::BaseObject";
|
|||||||
#
|
#
|
||||||
|
|
||||||
my $swagger_types = {
|
my $swagger_types = {
|
||||||
'id' => 'int',
|
'id' => 'Math::BigInt',
|
||||||
'name' => 'string'
|
'name' => 'string'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use base "WWW::SwaggerClient::Object::BaseObject";
|
|||||||
#
|
#
|
||||||
|
|
||||||
my $swagger_types = {
|
my $swagger_types = {
|
||||||
'id' => 'int',
|
'id' => 'Math::BigInt',
|
||||||
'username' => 'string',
|
'username' => 'string',
|
||||||
'first_name' => 'string',
|
'first_name' => 'string',
|
||||||
'last_name' => 'string',
|
'last_name' => 'string',
|
||||||
|
@ -171,8 +171,8 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
#
|
#
|
||||||
# @param array[string] $status Status values that need to be considered for filter (required)
|
# @param ARRAY[string] $status Status values that need to be considered for filter (required)
|
||||||
# @return array[Pet]
|
# @return ARRAY[Pet]
|
||||||
#
|
#
|
||||||
sub find_pets_by_status {
|
sub find_pets_by_status {
|
||||||
my ($self, %args) = @_;
|
my ($self, %args) = @_;
|
||||||
@ -215,7 +215,7 @@ sub new {
|
|||||||
if (!$response) {
|
if (!$response) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $_response_object = $self->{api_client}->deserialize('array[Pet]', $response);
|
my $_response_object = $self->{api_client}->deserialize('ARRAY[Pet]', $response);
|
||||||
return $_response_object;
|
return $_response_object;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -225,8 +225,8 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
#
|
#
|
||||||
# @param array[string] $tags Tags to filter by (required)
|
# @param ARRAY[string] $tags Tags to filter by (required)
|
||||||
# @return array[Pet]
|
# @return ARRAY[Pet]
|
||||||
#
|
#
|
||||||
sub find_pets_by_tags {
|
sub find_pets_by_tags {
|
||||||
my ($self, %args) = @_;
|
my ($self, %args) = @_;
|
||||||
@ -269,7 +269,7 @@ sub new {
|
|||||||
if (!$response) {
|
if (!$response) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $_response_object = $self->{api_client}->deserialize('array[Pet]', $response);
|
my $_response_object = $self->{api_client}->deserialize('ARRAY[Pet]', $response);
|
||||||
return $_response_object;
|
return $_response_object;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
#
|
#
|
||||||
# @param int $pet_id ID of pet that needs to be fetched (required)
|
# @param Math::BigInt $pet_id ID of pet that needs to be fetched (required)
|
||||||
# @return Pet
|
# @return Pet
|
||||||
#
|
#
|
||||||
sub get_pet_by_id {
|
sub get_pet_by_id {
|
||||||
@ -411,7 +411,7 @@ sub new {
|
|||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
#
|
#
|
||||||
# @param string $api_key (required)
|
# @param string $api_key (required)
|
||||||
# @param int $pet_id Pet id to delete (required)
|
# @param Math::BigInt $pet_id Pet id to delete (required)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub delete_pet {
|
sub delete_pet {
|
||||||
@ -472,7 +472,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# uploads an image
|
# uploads an image
|
||||||
#
|
#
|
||||||
# @param int $pet_id ID of pet to update (required)
|
# @param Math::BigInt $pet_id ID of pet to update (required)
|
||||||
# @param string $additional_metadata Additional data to pass to server (required)
|
# @param string $additional_metadata Additional data to pass to server (required)
|
||||||
# @param file $file file to upload (required)
|
# @param file $file file to upload (required)
|
||||||
# @return void
|
# @return void
|
||||||
|
@ -65,7 +65,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Returns pet inventories by status
|
# Returns pet inventories by status
|
||||||
#
|
#
|
||||||
# @return map[string,int]
|
# @return HASH[string,int]
|
||||||
#
|
#
|
||||||
sub get_inventory {
|
sub get_inventory {
|
||||||
my ($self, %args) = @_;
|
my ($self, %args) = @_;
|
||||||
@ -105,7 +105,7 @@ sub new {
|
|||||||
if (!$response) {
|
if (!$response) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $_response_object = $self->{api_client}->deserialize('map[string,int]', $response);
|
my $_response_object = $self->{api_client}->deserialize('HASH[string,int]', $response);
|
||||||
return $_response_object;
|
return $_response_object;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
#
|
#
|
||||||
# @param array[User] $body List of user object (required)
|
# @param ARRAY[User] $body List of user object (required)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub create_users_with_array_input {
|
sub create_users_with_array_input {
|
||||||
@ -171,7 +171,7 @@ sub new {
|
|||||||
#
|
#
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
#
|
#
|
||||||
# @param array[User] $body List of user object (required)
|
# @param ARRAY[User] $body List of user object (required)
|
||||||
# @return void
|
# @return void
|
||||||
#
|
#
|
||||||
sub create_users_with_list_input {
|
sub create_users_with_list_input {
|
||||||
|
@ -37,5 +37,3 @@ print "\nupdate_pet_with_form:".Dumper $api->update_pet_with_form(pet_id => $pet
|
|||||||
print "\ndelete_pet:".Dumper $api->delete_pet(pet_id => $pet_id);
|
print "\ndelete_pet:".Dumper $api->delete_pet(pet_id => $pet_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user