Skip to content

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

Merged
merged 15 commits into from
Jan 28, 2022

Conversation

robertmarney
Copy link
Contributor

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

This utilizes the Form Request rules to populate the description field in the collection.

This change helps guide the API user when completing requests.
Copy link
Owner

@andreaselia andreaselia left a 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 👍

@andreaselia
Copy link
Owner

Looks good (pending tests, of course). Thanks for coming back to contribute your suggestion in #48 ❤️

@robertmarney
Copy link
Contributor Author

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?

@andreaselia
Copy link
Owner

andreaselia commented Jan 23, 2022

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.

@andreaselia
Copy link
Owner

@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.

@andreaselia andreaselia self-requested a review January 23, 2022 21:54

$requestRules[] = [
'name' => $fieldName,
'description' => $printRules ? $rule ?? '' : '',
Copy link
Collaborator

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 ?? '' : '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines 177 to 180
Storage::disk($this->config['disk'])->put(
$exportName = "postman/$this->filename",
json_encode($this->structure)
);
Copy link
Collaborator

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?

Copy link
Contributor Author

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();
Copy link
Collaborator

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.

@tomirons
Copy link
Collaborator

@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.

@robertmarney
Copy link
Contributor Author

@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 robertmarney requested a review from tomirons January 28, 2022 18:52
@tomirons tomirons merged commit 9583758 into andreaselia:master Jan 28, 2022
@tomirons
Copy link
Collaborator

@robertmarney nice job on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants