Skip to content

Commit 1ac6842

Browse files
committed
Update mustache template to pass hashes in TO_JSON and from_hash
1 parent 57e3ea3 commit 1ac6842

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sub to_hash {
2828
sub TO_JSON {
2929
my $self = shift;
3030
my $_data = {};
31-
foreach my $_key (keys $self->get_attribute_map) {
31+
foreach my $_key (keys %{$self->get_attribute_map}) {
3232
if (defined $self->{$_key}) {
3333
$_data->{$self->get_attribute_map->{$_key}} = $self->{$_key};
3434
}
@@ -40,7 +40,7 @@ sub TO_JSON {
4040
sub from_hash {
4141
my ($self, $hash) = @_;
4242
# loop through attributes and use swagger_types to deserialize the data
43-
while ( my ($_key, $_type) = each $self->get_swagger_types ) {
43+
while ( my ($_key, $_type) = each %{$self->get_swagger_types} ) {
4444
if ($_type =~ /^array\[/i) { # array
4545
my $_subclass = substr($_type, 6, -1);
4646
my @_array = ();

0 commit comments

Comments
 (0)