Closed
Description
Hi,
I'm using json_schema within a Rails (3.0.10) project which uses some gems (such as oauth2) tied to an old version of multi_json (~> 1.0.0) which use the old "decode" instead of "load". The problem is this line in validator.rb (line 414):
MultiJson.respond_to?(:load) ? MultiJson.load(s) : MultiJson.decode(s)
The problem is that in the Rails context the module responds to load, even though I am using the old version of multi_json. This seems to have to do with autoloading or something. So what happens is a load
method in active_support/dependencies.rb
is run and it tries to load the JSON file as a Ruby file!
Perhaps we could make the opposite check?
MultiJson.respond_to?(:decode) ? MultiJson.decode(s) : MultiJson.load(s)
Otherwise, the way I got around was by monkey patch JSON::Schema::Validator (monkey patching MultiJson.load didn't work for some reason)
class JSON::Schema::Validator
def parse
MultiJson.decode(s)
end
end
Thanks
Evan
Metadata
Assignees
Labels
No labels