Skip to content

Commit

Permalink
Skip more keywords when generating routes, closes jhthorsen/mojolicio…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Henning Thorsen committed Jun 17, 2021
1 parent 380fce5 commit f322204
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/JSON/Validator/Schema/OpenAPIv2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use Mojo::Collection;

my $X_RE = qr{^x-};

# Some of the keywords are OpenAPIv3 keywords
my %SKIP_KEYWORDS_IN_PATH = map { ($_, 1) } qw(description parameters servers summary);

has errors => sub {
my $self = shift;
my $validator = $self->new(%$self, allow_invalid_ref => 0)->resolve($self->specification);
Expand Down Expand Up @@ -149,7 +152,7 @@ sub routes {
for my $path (@sorted_paths) {
next unless my $methods = $self->get([paths => $path]);
for my $method (sort keys %$methods) {
next if $method =~ $X_RE or $method eq 'parameters';
next if $method =~ $X_RE or $SKIP_KEYWORDS_IN_PATH{$method};
push @operations, {method => $method, operation_id => $methods->{$method}{operationId}, path => $path};
}
}
Expand Down

0 comments on commit f322204

Please sign in to comment.