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

Can't validate with fragment #64

Closed
zverok opened this issue Jul 27, 2013 · 1 comment
Closed

Can't validate with fragment #64

zverok opened this issue Jul 27, 2013 · 1 comment

Comments

@zverok
Copy link

zverok commented Jul 27, 2013

  schema = {
    "type" => "object",
    "required" => ["a","b"],
    "properties" => {
      "a" => {"type" => "integer"},
      "b" => {"type" => "string"},
      "c" => {
        "type" => "object",
        "properties" => {
          "z" => {"type" => "integer"}
        }
      }
    }
  }

  data = {
    "z" => 1
  }

  JSON::Validator.validate!(schema, data, :fragment => "#/properties/c")

Code almost from README, throws "Invalid schema encountered when resolving :fragment option (JSON::Schema::SchemaError)"

PS: In fact, there seem to be many problems with my test case, which is just one long schema with several object in it, like in http://stackoverflow.com/a/9083830. I'm not sure, what number of issues should be created (or what number of changes should I do in my code).

For example, having such schema (with "id"s and "$ref"s) in hash, I can't even start using it, receiving "`rescue in merge': both URI are relative (URI::BadURIError)" at the very beginning.

arcticlcc referenced this issue in arcticlcc/json-schema Sep 4, 2013
Test if fragment is a JSON:Schema instance
Make sure to return JSON::Schema from schema_from_fragment()
Moved test_fragment_resolution.rb to 'test' directory
hoxworth added a commit that referenced this issue Dec 31, 2013
Fixed fragment resolution. Issue #64
@hoxworth
Copy link
Contributor

This appears to have been fixed with @articlcc 's commit 866e33a8, and has been released in 2.1.4. Please check again with the latest version.

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

No branches or pull requests

2 participants