Open thomasbalsloev opened 5 years ago
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": https://github.com/ruby/ipaddr/commit/b27ea42a1c80f4d82bf03d378bbde74bc20583b2
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'
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": https://github.com/ruby/ipaddr/commit/b27ea42a1c80f4d82bf03d378bbde74bc20583b2
but only ArgumentError is catched here:
https://github.com/ruby-json-schema/json-schema/blob/2f95d53d62428d603601a1346d6e12a70e7a505d/lib/json-schema/attributes/formats/ip.rb#L13