Closed weretyczx closed 4 years ago
Hey, this is an interesting idea. I think it would be difficult parsing every single middleware and guessing which ones are auth and what auth method they use, unless there was some sort of mapping for middleware name => what it means. But I can at least look into supporting this if the app is using Passport and whatever convention it uses. Need to think about this one a little more. Thanks for the suggestion!
Pushed out a decent solution for this if the consuming application is using Passport: https://github.com/mtrajano/laravel-swagger/pull/23 and https://github.com/mtrajano/laravel-swagger/commit/463320d4c26ddd762f5856dddf914421625d6e0d. If following the documentation given in: https://laravel.com/docs/5.8/passport including registering the Passport routes and middleware this should correctly generate the securityDefinitions and add the correct scopes to each operation object. Please pull down dev-master
and let me know if that works for you. Feel free to submit a pr if you think you can make any improvements, thanks!
Hi, me again. hahaha, have some problem here, some api needs to passing token, and for now, the generated document structural have't been support yet, have u consider to implement this issue by reading the middleware?
After all, in order to persist the route nicely read, the less work to optimize the document can adding a artisan command option
--sort
, so the related api will generate together.thanks !