-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Less active support concern #2574
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
Less active support concern #2574
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.
Pull Request Overview
This PR refactors several DSL modules by switching from instance inclusion to class extension, removes reliance on ActiveSupport::Concern, and cleans up deprecated or redundant code. Key changes include:
- Removal of legacy tests for Grape::DSL::Validations in the integration specs.
- Updating DSL modules and helper methods across multiple files to use concise patterns and extend modules.
- Eliminating deprecated code files and streamlining settings and middleware definitions.
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
spec/integration/dry_validation/dry_validation_spec.rb | Removed the Grape::DSL::Validations tests to deprecate inactive support |
spec/grape/validations/validators/coerce_validator_spec.rb | Updated to refer to Grape::Validations::Types::InvalidValue for consistency |
spec/grape/dsl/* and lib/grape/dsl/* | Converted many modules from include to extend and removed ActiveSupport::Concern usage, among other DSL cleanup changes |
lib/grape/api/* | Simplified API instance logger handling and removed deprecated helper definitions |
Comments suppressed due to low confidence (1)
spec/integration/dry_validation/dry_validation_spec.rb:3
- The removal of tests for Grape::DSL::Validations may reduce coverage; please ensure that the new behavior is adequately tested elsewhere.
describe 'Dry::Schema', if: defined?(Dry::Schema) do
002f15b
to
369445c
Compare
2ff6075
to
4a89c18
Compare
it 'evaluates block' do | ||
expect { subject.params { raise 'foo' } }.to raise_error RuntimeError, 'foo' | ||
def self.namespace_stackable_hash | ||
@namespace_stackable_hash ||= Hash.new do |hash, key| |
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 causes a side effect, doesn't it? Clear it? A few other instances of the same, let's make sure tests don't leak.
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've done the same pattern elsewhere. Since some module are dependent, I need to recreate the functions in the anonymous class.
This won't leak
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.
Since some modules are dependent, i'll check if I can combine them.
4a89c18
to
50875c2
Compare
Here's an example of a CHANGELOG.md entry: * [#2574](https://github.com/ruby-grape/grape/pull/2574): Less active support concern - [@ericproulx](https://github.com/ericproulx). Generated by 🚫 Danger |
b22431a
to
c5771ff
Compare
Remove invalid value short name (not used)
c5771ff
to
0df0860
Compare
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 looks good.
Refactor DSL modules by removing unnecessary ActiveSupport::Concern
This PR refactors the Grape DSL modules to remove unnecessary
ActiveSupport::Concern
usage and simplify the codebase architecture.Changes
DSL Module Refactoring
ActiveSupport::Concern
from all DSL modules where it was unnecessaryincluded
andextended
callbacks that weren't providing valueAffected Modules
Grape::DSL::Callbacks
- Simplified callback registrationGrape::DSL::Helpers
- Streamlined helper module inclusionGrape::DSL::Routing
- Cleaner route definition and mountingGrape::DSL::RequestResponse
- Simplified request/response handlingGrape::DSL::Settings
- Cleaner configuration managementGrape::DSL::Validations
- Streamlined validation setupGrape::DSL::Middleware
- Simplified middleware configurationGrape::DSL::Parameters
- Cleaner parameter handlingGrape::DSL::Logger
- Simplified logging setupGrape::DSL::InsideRoute
- Streamlined route executionGrape::DSL::Desc
- Simplified description handlingGrape::DSL::Configuration
- Cleaner configuration managementCode Cleanup
invalid_value
short name that wasn't being usedTesting
Benefits
Performance
Maintainability
Compatibility
Impact
This refactoring is a non-breaking change that improves the internal architecture of Grape's DSL system. All existing Grape applications will continue to work without modification, but will benefit from:
Testing