Skip to content

Commit 7742401

Browse files
use consistent variable names
1 parent 9044485 commit 7742401

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/OpenAPI/Modern.pm

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,10 @@ sub _validate_path_parameter ($self, $state, $param_obj, $path_captures) {
711711
'missing path parameter: %s', $param_obj->{name})
712712
if not exists $path_captures->{$param_obj->{name}};
713713

714-
my $value = $path_captures->{$param_obj->{name}};
715-
$value .= '';
714+
my $data = $path_captures->{$param_obj->{name}};
715+
$data .= '';
716716

717-
return $self->_validate_parameter_content({ %$state, depth => $state->{depth}+1 }, $param_obj, \$value)
717+
return $self->_validate_parameter_content({ %$state, depth => $state->{depth}+1 }, $param_obj, \$data)
718718
if exists $param_obj->{content};
719719

720720
return E({ %$state, keyword => 'style' }, 'only style: simple is supported in path parameters')
@@ -725,7 +725,7 @@ sub _validate_path_parameter ($self, $state, $param_obj, $path_captures) {
725725
return E($state, 'deserializing to non-primitive types is not yet supported in path parameters');
726726
}
727727

728-
$self->_evaluate_subschema(\$value, $param_obj->{schema}, { %$state, schema_path => $state->{schema_path}.'/schema', stringy_numbers => 1, depth => $state->{depth}+1 });
728+
$self->_evaluate_subschema(\$data, $param_obj->{schema}, { %$state, schema_path => $state->{schema_path}.'/schema', stringy_numbers => 1, depth => $state->{depth}+1 });
729729
}
730730

731731
sub _validate_query_parameter ($self, $state, $param_obj, $uri) {
@@ -739,15 +739,17 @@ sub _validate_query_parameter ($self, $state, $param_obj, $uri) {
739739
return 1;
740740
}
741741

742-
return $self->_validate_parameter_content({ %$state, depth => $state->{depth}+1 }, $param_obj, \ $query_params->{$param_obj->{name}})
742+
my $data = $query_params->{$param_obj->{name}};
743+
744+
return $self->_validate_parameter_content({ %$state, depth => $state->{depth}+1 }, $param_obj, \$data)
743745
if exists $param_obj->{content};
744746

745747
# §4.8.12.2.1: "If `true`, clients MAY pass a zero-length string value in place of parameters that
746748
# would otherwise be omitted entirely, which the server SHOULD interpret as the parameter being
747749
# unused."
748750
return if $param_obj->{allowEmptyValue}
749751
and ($param_obj->{style}//'form') eq 'form'
750-
and not length($query_params->{$param_obj->{name}});
752+
and not length($data);
751753

752754
# TODO: check 'allowReserved'; difficult to do without access to the raw request string
753755

@@ -765,7 +767,7 @@ sub _validate_query_parameter ($self, $state, $param_obj, $uri) {
765767
}
766768

767769
$state = { %$state, schema_path => $state->{schema_path}.'/schema', stringy_numbers => 1, depth => $state->{depth}+1 };
768-
$self->_evaluate_subschema(\ $query_params->{$param_obj->{name}}, $param_obj->{schema}, $state);
770+
$self->_evaluate_subschema(\$data, $param_obj->{schema}, $state);
769771
}
770772

771773
# validates a header, from either the request or the response
@@ -818,7 +820,7 @@ sub _validate_header_parameter ($self, $state, $header_name, $header_obj, $heade
818820
}
819821

820822
$state = { %$state, schema_path => $state->{schema_path}.'/schema', stringy_numbers => 1, depth => $state->{depth}+1 };
821-
$self->_evaluate_subschema(\ $data, $header_obj->{schema}, $state);
823+
$self->_evaluate_subschema(\$data, $header_obj->{schema}, $state);
822824
}
823825

824826
sub _validate_cookie_parameter ($self, $state, $param_obj, $request) {

0 commit comments

Comments
 (0)