Skip to content

Schema validation is broken in master #135

Closed
@bkirz

Description

It appears to be looking for the metaschema in the wrong place. I suspect (but haven't verified) that it was broken in 47ddd7b since I don't see the previous logic for finding the metaschema relative to the current file included anywhere after the refactor.

Reproduction steps:

~/dev → mkdir new-project
~/dev → cd new-project
~/d/new-project → bundle init
Writing new Gemfile to /Users/benjamin/dev/new-project/Gemfile
~/d/new-project → echo 'gem "json-schema", git: "https://github.com/hoxworth/json-schema.git"' >> Gemfile
~/d/new-project → bundle install
Fetching https://github.com/hoxworth/json-schema.git
Fetching gem metadata from https://rubygems.org/...
Resolving dependencies...
Using json-schema 2.2.5 from https://github.com/hoxworth/json-schema.git (at master)
Using bundler 1.6.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
~/d/new-project → bundle exec irb
irb(main):001:0> require 'json-schema'
=> true
irb(main):002:0> JSON::Validator.fully_validate_schema(type: :object, properties: {})
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/benjamin/dev/new-project/resources/draft-04.json
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/uri/file.rb:31:in `initialize'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/uri/file.rb:31:in `open'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/uri/file.rb:31:in `open'
        from /Users/benjamin/.rubies/ruby-2.1.2/lib/ruby/2.1.0/open-uri.rb:34:in `open'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:513:in `rescue in initialize_schema'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:492:in `initialize_schema'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:47:in `block in initialize'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:47:in `synchronize'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:47:in `initialize'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:295:in `new'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:295:in `fully_validate'
        from /Users/benjamin/.gem/ruby/2.1.2/bundler/gems/json-schema-909eeffaac23/lib/json-schema/validator.rb:302:in `fully_validate_schema'
        from (irb):2
        from /Users/benjamin/.rubies/ruby-2.1.2/bin/irb:11:in `<main>'

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions