-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add endpoint for listing all WebAPI routes #6070
Conversation
b38f27d
to
6fdf5f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea and it might indeed be interesting for dynamic completion.
No codecov result. I'll force push. I would expect that the module appears as uncovered, as I didn't add any tests so far |
Still no results. Recent webhook deliveries look good but there's probably some problem on the Codecov side right now. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6070 +/- ##
=======================================
Coverage 98.98% 98.98%
=======================================
Files 395 396 +1
Lines 39508 39527 +19
=======================================
+ Hits 39108 39127 +19
Misses 400 400 ☔ View full report in Codecov by Sentry. |
… and now there is the report :) |
my $pattern = $route->pattern->unparsed || ''; | ||
my @methods; | ||
if ($route->can('methods')) { | ||
@methods = @{($route->methods) || []}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the empty list should never be empty. I am not sure how you can handle this but it feels wrong, no? or maybe I do not understand something here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. An empty list is empty.
methods
might return undef, in which case @{ somehing undef }
will error, so @{ somehing undef || []}
is needed.
btw, I copied this code from https://github.com/os-autoinst/openQA/blob/master/templates/webapi/not_found.html.ep#L26
openqa-cli api routes
I added a test and simplified the _walk method a bit |
I find it cumbersome to find out routes currently. The webpage 404 page, e.g. https://openqa.opensuse.org/foo , is very long and I lose the overview under which top level route I am.
This could also be useful later for creating dynamic completion, e.g.
openqa-cli api j<TAB>