-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I have a file that passes the other linters, including the one from Swagger, but openapi-linter blows up:
$ openapi-linter --spec some_file.yml
I get:
Not a HASH reference at /usr/local/perls/perl-5.42.0/lib/site_perl/5.42.0/OpenAPI/Linter.pm line 185.
This comes from code like:
for my $method (sort keys %{$spec->{paths}{$path}}) {
my $op = $spec->{paths}{$path}{$method};
push @issues, {
level => 'WARN',
message => "Missing description for $method $path"
} unless $op->{description};
}
You assume that the value in $op is a hash reference. If it isn't, there should be a different validation error. Once you have verified that $op is a hashref, you can move on to the other checks. This is especially important when you expect malformed formats.
There are several other areas in the code where this is also a problem.
Metadata
Metadata
Assignees
Labels
No labels