mtrajano / laravel-swagger

Auto generates the swagger documentation of a laravel project based on best practices and simple assumptions
167 stars 71 forks source link

fix Str::startsWith need string error #14

Closed weretyczx closed 4 years ago

weretyczx commented 4 years ago

Hi there, First of all, thanks u to spend a lot of time building this awesome package, it really allay the pain to generate api document. But I found some problem here at version "mtrajano/laravel-swagger": "^0.6.0", it cause by the commend php artisan laravel-swagger:generate > swagger.json

螢幕快照 2019-12-04 下午2 32 26

GeneratesFromRules.php

螢幕快照 2019-12-04 下午2 47 59

The reason is the $rule variable have pass the object (Laravel Rule Object) getting exception, and I already fix this issue, please check up the code below before merge, thanks.

p.s. My editer auto format the elseif to else if and I forgot to ignore the change, i haven't change at that line

mtrajano commented 4 years ago

Hello thank you for the for the pr, I will take a look at it tonight. In the meantime would you mind fixing the elseif (I need to add a linter to the repo) and adding a test to validate the fix? Thanks once again!

weretyczx commented 4 years ago

Hello thank you for the for the pr, I will take a look at it tonight. In the meantime would you mind fixing the elseif (I need to add a linter to the repo) and adding a test to validate the fix? Thanks once again!

Sure, I already recoveredelse if style and send it to pr.

mtrajano commented 4 years ago

Made a small change to not break Rules that implement __toString, since they are objects but you may still use string functions on them ex: https://laravel.com/docs/5.7/validation#rule-in and added tests as well. Great job, thanks for the pr!