Skip to content
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 using endless ranges for values parameter. #2323

Merged
merged 1 commit into from
May 8, 2023
Merged

fix using endless ranges for values parameter. #2323

merged 1 commit into from
May 8, 2023

Conversation

dhruvCW
Copy link
Contributor

@dhruvCW dhruvCW commented May 6, 2023

allows using endless range for values validator.

e.g.

params do
  requires :minimum, type: Integer, values: 10..
  optional :maximum, type: Integer, values: ..10 
end

@dblock
Copy link
Member

dblock commented May 8, 2023

Perfect thank you.

@dblock dblock merged commit 1f876b2 into ruby-grape:master May 8, 2023
@dblock
Copy link
Member

dblock commented May 9, 2023

I missed a failure here in CI because I was trained not to see it in all the edge failures :(

rspec ./spec/grape/validations/validators/values_spec.rb:390 # Grape::Validations::Validators::ValuesValidator does not allow an invalid value for a parameter using an endless range
rspec ./spec/grape/validations/validators/values_spec.rb:384 # Grape::Validations::Validators::ValuesValidator validates against values in an endless range

I disabled it for ActiveSupport < 6 in #2325, but please do PR a fix if you know of one.

@dhruvCW dhruvCW deleted the endless_range branch May 9, 2023 09:43
@dhruvCW
Copy link
Contributor Author

dhruvCW commented May 9, 2023

I disabled it for ActiveSupport < 6 in #2325, but please do PR a fix if you know of one.

thanks for patching the tests. The issue is because of a bug in rails 5.2 which was fixed in rails 6 but not backported.

rails/rails#36460

given rails 5.2 has already reached end of life a while back I don't think it's worth the effort to try and work around this problem.

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.

2 participants