-
Notifications
You must be signed in to change notification settings - Fork 106
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 new information to LRD #365
Conversation
Thanks, give me some time. I'd need to test it. |
I couldn't run |
I had not performed the necessary adjustments to the tests, in this last commit I inserted the new values into the mock, so the tests are passing normally |
# Conflicts: # config/request-docs.php # src/Doc.php # src/LaravelRequestDocs.php # tests/mocks/lrd-response.json # ui/src/libs/types.tsx
Hi @kevincobain2000, I made the necessary adjustments for my branch to pass the test, I had to do a development merge into my master branch to resolve the conflicts, so the two changes I made were in a single PR, so now I have a resource to generate examples a by from the factories and also from the layout adjustments that were made. |
@fernandopiovezan1 Please rebase from |
Thanks. Let me test on the latest commit. |
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.
Hi @fernandopiovezan1, thank you for the PR.
I have done the first round review, but to be honest I stop review at some point due to the amount of changes needed I have seen.
Thank you for your efforts to add the following keys:
summary
description
field_info
rules_order
tag
examples
I like the 1., 2., and 5. implementation, for me they are perfect.
The 3. is okay, but I am being hold back by the idea to add a new method to the Request class, I just feel like it is not the best way to do it.
For 4., I am not sure if we really need it.
For 6., I feel like it is incomplete, and I wonder how could we make it possible for general use for different use cases. Also, I have some difficulty to picture what is the expected output.
The test is missing for all the new keys, and I think it is important to have them.
Currently, you are just setting the missing key in the mock json, but it is not enough..
I think I will need to do a second round of review, but I would like to ask you to consider the following:
- Do we have a better way to implement the
field_info
? - Do we really need the
rules_order
? - Could you complete the
examples
implementation? Else I would like to suggest to remove it. - Cover all features with test, and the test should always failed without your feature.
'in' => 'query', | ||
'name' => $attribute, | ||
'description' => $description['description'] ?? $rule, | ||
'example' => $description['example'] ?? null, |
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.
Is there any way for us to validate the OpenAI specification?
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.
@kitloong I don't understand this question, if you could explain it better it would help. thanks.
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.
@kitloong is trying to check if the new changes that come to openAPI generated json have been tested using Postman.
I ll test it out, you can skip this comment.
@@ -181,4 +181,20 @@ | |||
], | |||
|
|||
'use_factory' => false, | |||
|
|||
'rules_order' => [ |
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.
May I know why do we need to add this ordering?
If the user want to decided the ordering, can't they define from the rules
?
'page' => 'nullable|integer|min:1',
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.
The definition can only be done through the format that the operator defines in the rule as you posted, but when winning as a team the rules are not always defined in the same order so we don't have a standard and at least in my opinion it looks messy in documents like In the print below, I added this option simply to organize the rules cohesively but there is still the possibility of not passing the ordering and thus returning as defined in the method
@kitloong I uploaded some changes so that the validations don't get too big, there are still a few points left that I should finish by the weekend. Any other notes I am at your disposal |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #365 +/- ##
==========================================
Coverage ? 82.86%
Complexity ? 215
==========================================
Files ? 8
Lines ? 753
Branches ? 0
==========================================
Hits ? 624
Misses ? 129
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Hello @kevincobain2000 and @kitloong , I completed the requested adjustments, mostly as requested and others with some differences for correct operation. I will explain the reason for each of the points that left you with doubts. |
Thanks @fernando-piovezan-instar |
Thank you @fernandopiovezan1 In
Then, we have factory example in How this 2 works together, and could you provide a screenshot from your side for different scenario?
|
Hi @kitloong There really were a lot of changes and I ended up forgetting to update the readme (I updated it now), the example key was removed from the fieldDescriptions() method, this method will only return the field description, the example will still be used but it will come directly from which was already generated by the factory, so it eliminates the duplication of examples, I believe that in this format the code becomes cleaner, the fieldDescription was very similar to the attributes() method of the formRequest (I considered using it but as it is a description validation messages look strange so I kept the description method). Sorry for not updating the readme sooner. Thanks |
Hi @fernandopiovezan1 , sorry for the late reply and thank you for the screenshots. First of all, I think extracting the model from the controller name and factory name is not a good implementation to generate the example. However, I am convinced we could provide examples at:
It makes more sense as it follows the request fields. Second, LRD should display the real ordering defined in In summary, I am okay to add the following features:
|
Hi @kitloong, I understand from your point of view, despite not agreeing, mainly with the question of factory nomenclatures, that Laravel instructed us to use exactly the form that was implemented Controller, Models, Factories, etc. following the same nomenclature, changing only or suffix. So by convention you have to disagree with your opinion. Thanks |
Thanks for all the efforts. Will cherry pick the commits that @kitloong mentioned. I also agree with not including the factory and rules ordering. |
Really? When did that become a must? And is it on PHPStan or other Linters that can catch it? |
Closing it as patch on a fork. Thanks for submitting. |
Add summary to routes
Add description to routes
Add friendly name to route menu
Add description to the field along with the rules
Add example to the field next to the rules
Add tags for grouping routes in OpenAPI export
Changes rules display format from vertical to horizontal (use of space)
resolve #362
Related issues
#301
#331