-
Notifications
You must be signed in to change notification settings - Fork 463
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
Fix error for hash object warnings with delegated method descriptions #938
Merged
mathieujobin
merged 4 commits into
Apipie:master
from
meetcleo:fix-error-for-hash-object-warnings-with-delegated-method-descriptions
Jul 16, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e1fd88a
Use `method_name` instead of `method` when generating hash warnings
h-lame accd783
Use `method_name` instead of `method` when generating required warnings
h-lame ba599dc
Fix rubocop-rspec by removing a redundant `let`
h-lame 6d84540
Handle warnings for param descriptions without a controller method
h-lame File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we end up with a blank
@controller_method
?If so maybe we could add a test case for that & update the builder's YARD block to
# @param [Apipie::MethodDescription, nil] controller_method
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.
I admit that I haven't really dug into the "could
@controller_method
benil
" question. I added the@controller_method.present?
check because of a test failing. I don't really know if in the normal usage of these objects to define API docs you would ever have anil
in there. But, obviously, the code doesn't actually prevent it.I could take the check out and try to trace the test that failed a bit deeper to understand why it's able to construct the world where it's exercising these objects without a
@controller_method
being set. I don't really know what else might break elsewhere if it'snil
.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.
A
nil
@controller_method
is expected if we calljson_schema_for_self_describing_class
(seeapipie-rails/lib/apipie/swagger_generator.rb
Lines 36 to 43 in 4be3741
Apipie::Generator::Swagger::ParamDescription::Builder
with anil
@controller_method
. I'll update the YARD block and introduce an explicit test for it beingnil
.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.
Ok, added a new commit that changes the YARD for
Apipie::Generator::Swagger::ParamDescription::Builder
and puts in tests for both Apipie::Generator::Swagger::ParamDescription::Builder and Apipie::Generator::Swagger::ParamDescription::Type when emitting warnings withPropDesc
for aparam_description
andnil
for acontroller_method
.