-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 autoload types and validators #2222
Fix autoload types and validators #2222
Conversation
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.
Do I understand right that the original PRs #2207 #2209 solve some "consistency problem" where some part of the code is autoloaded and some part is not? without some numbers, it is unclear whether this is a problem at all.
but I like the part with autoloading validators based on :short_name
, it echoes to the first part of #2204(though it's not enough for proper integration with Rails for example)
i don’t think it’s a problem either way; if my memory serves me correctly there were issues trying to move validators to auto loading and so this was left alone - sounds like we don’t have any issues with going one way or another, I vote to move to auto loading for consistency |
that works for me |
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.
So, take a look to the comments and rebase the branch(we should not have an intermediate "merge master" commits here). Thanks!
…tically done through inheritance
38d7e42
to
e553a40
Compare
Add back DryTypes
CHANGELOG.md
Outdated
@@ -6,6 +6,7 @@ | |||
|
|||
#### Fixes | |||
|
|||
* [#2222](/~https://github.com/ruby-grape/grape/pull/2222): autoload types and validators - [@ericproulx](/~https://github.com/ericproulx). |
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.
Capitalize Autoload
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 changes looks good to me.
though, the commits history looks sloppy :) I can help to fix it(later tonight).
I just squash-merged, thanks @ericproulx for the code, and @dm1try for a thorough code review. |
Hi,
I've found a solution for the #2218 AND #2221. This PR adds a
lazy_find_validator
function that loads Grape's validators when needed. That way, we don't have to require all of them since the autoload doesn't trigger theinherited
function.Also,
ArrayCoercer
andSetCoercer
were registering aDryTypeCoercer
collection through inheritance. I had to find another way to register the collection. Therefore, I applied the same technique.Finally, that way, we can remove safely the
eager_load!
#2216 in thespec_helper
. I ran several specs in our stack and I haven't found any issues.Happy New Year 🍾