This repository has been archived by the owner on Jun 22, 2020. It is now read-only.
forked from voxpupuli/json-schema
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
$ref schemas inside of allOf, anyOf, etc wasn't being loaded. This patch adds support for it.
- Loading branch information
Showing
7 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"names" : | ||
[ "john" | ||
, "jane" | ||
, "jimmy" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "$schema" : "http://json-schema.org/draft-04/schema#" | ||
, "type" : "string" | ||
, "pattern" : "jane" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "$schema" : "http://json-schema.org/draft-04/schema#" | ||
, "type" : "string" | ||
, "pattern" : "jimmy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "$schema" : "http://json-schema.org/draft-04/schema#" | ||
, "type" : "string" | ||
, "pattern" : "john" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ "$schema" : "http://json-schema.org/draft-04/schema#" | ||
, "type" : "object" | ||
, "properties" : | ||
{ "names" : | ||
{ "type" : "array" | ||
, "items" : | ||
{ "anyOf" : | ||
[ { "$ref" : "any_of_ref_john_schema.json" } | ||
, { "$ref" : "any_of_ref_jane_schema.json" } | ||
, { "$ref" : "any_of_ref_jimmy_schema.json" } | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'test/unit' | ||
require File.dirname(__FILE__) + '/../lib/json-schema' | ||
|
||
class AnyOfRefSchemaTest < Test::Unit::TestCase | ||
def test_all_of_ref_schema | ||
schema = File.join(File.dirname(__FILE__),"schemas/any_of_ref_schema.json") | ||
data = File.join(File.dirname(__FILE__),"data/any_of_ref_data.json") | ||
errors = JSON::Validator.fully_validate(schema,data, :errors_as_objects => true) | ||
assert(errors.empty?, errors.map{|e| e[:message] }.join("\n")) | ||
end | ||
end |