-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
JSON::Validator modifies schema object #83
Comments
Actually this causes the following error schema = { type: "object" }
schema.default_proc # => nil
JSON::Validator.validate(schema, { }) # => true
schema.default_proc # => => #<Proc:0x007fe1ca5b5280@/User...>
JSON::Validator.validate(schema, { })
# TypeError: can't dump hash with default proc
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:523:in `dump'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:523:in `block in singleton class'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:548:in `call'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:548:in `serialize'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:605:in `initialize_schema'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:160:in `block in initialize'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:160:in `synchronize'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:160:in `initialize'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:365:in `new'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-schema-2.1.3/lib/json-schema/validator.rb:365:in `validate' |
Related to #62 - the |
This should be fixed in 2.1.5. Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think that this is bad behaviour for
JSON::Validator.validate
, it should not modify the schema param. Any thoughts?The text was updated successfully, but these errors were encountered: