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

Ruby 2.6.1: fully_validate throws exception anyway #430

Open
thomasbalsloev opened this issue Feb 18, 2019 · 0 comments
Open

Ruby 2.6.1: fully_validate throws exception anyway #430

thomasbalsloev opened this issue Feb 18, 2019 · 0 comments

Comments

@thomasbalsloev
Copy link

Hi!
Thanks for this very useful gem!

We are about to upgrade our ruby to 2.6.1 and when I ran our rspec suite two tests suddenly failed.

A field validation with format "ip4v" on some bogus data raises an exception instead of being collected in the errors array.

Looks like the exception type has changed in module "IPaddr" and is no longer just an "ArgumentError": ruby/ipaddr@b27ea42

but only ArgumentError is catched here:

https://github.com/ruby-json-schema/json-schema/blob/2f95d53d62428d603601a1346d6e12a70e7a505d/lib/json-schema/attributes/formats/ip.rb#L13

Exception raised: IPAddr::InvalidAddressError: invalid address: 123

/home/tb/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/ipaddr.rb:598:in `rescue in initialize'
/home/tb/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/ipaddr.rb:557:in `initialize'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/attributes/formats/ip.rb:12:in `new'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/attributes/formats/ip.rb:12:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/attributes/format.rb:10:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema/validator.rb:25:in `block in validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema/validator.rb:23:in `each'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema/validator.rb:23:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema.rb:33:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/attributes/properties.rb:32:in `block in validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/attributes/properties.rb:14:in `each'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/attributes/properties.rb:14:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema/validator.rb:25:in `block in validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema/validator.rb:23:in `each'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema/validator.rb:23:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/schema.rb:33:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/validator.rb:115:in `validate'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/validator.rb:256:in `validate!'
/home/tb/.rvm/gems/ruby-2.6.1@rails51/gems/json-schema-2.8.1/lib/json-schema/validator.rb:273:in `fully_validate'
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 a pull request may close this issue.

1 participant