-
-
Notifications
You must be signed in to change notification settings - Fork 102
Utilize Rules via FormRequest to populate description #61
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
Conversation
This utilizes the Form Request rules to populate the description field in the collection. This change helps guide the API user when completing requests.
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.
Don't be afraid to space things out to make things more readable 👍
Looks good (pending tests, of course). Thanks for coming back to contribute your suggestion in #48 ❤️ |
@andreaselia - my pleasure. Tests are up. I cannot figure out what styleci is complaining about, maybe you can help with that? |
Cheers for adding the tests, @robertmarney. I'll take a look at StyleCI today (Sunday) and see what's going on. |
@robertmarney StyleCI issue has been resolved (needed a blank line at the end of the file). This looks good to me, but I'll be waiting for @tomirons to also review it before merging to see if he has spotted anything that I may have missed. |
|
||
$requestRules[] = [ | ||
'name' => $fieldName, | ||
'description' => $printRules ? $rule ?? '' : '', |
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.
This is confusing to me, can it be cleaned up a bit?
$requestRules[] = $fieldName.'_confirmation'; | ||
$requestRules[] = [ | ||
'name' => $fieldName.'_confirmation', | ||
'description' => $printRules ? $rule ?? '' : '', |
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.
Same here.
Storage::disk($this->config['disk'])->put( | ||
$exportName = "postman/$this->filename", | ||
json_encode($this->structure) | ||
); |
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.
What was the point of reformatting this?
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.
Reverting, my IDE got a bit excited with the long line. :)
protected function parseRulesIntoHumanReadable($attribute, $rules): string | ||
{ | ||
if (! $this->config['rules_to_human_readable']) { | ||
return is_array($rules) ? implode(', ', $rules) : $rules->__toString(); |
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.
This is assuming that the $rules
is a Rule
class. This would throw an error if it was not for some reason.
@robertmarney this is a great addition to the package. I left a few concerns that I feel need addressed before it can be merged in. |
Hey Tom, thanks for the feedback, I will do my best to clean things up during the week. |
@robertmarney nice job on this! |
This utilizes the Form Request rules to populate the description field in the collection.
This change helps guide the API user when completing requests.
If this looks good I can go back and remove the changes to white spaces etc and write some tests.
Rob