json_schema_validator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/json_schema_validator.gemspec +41 -0
- data/lib/json_schema_validator.rb +44 -0
- data/lib/json_schema_validator/base.rb +80 -0
- data/lib/json_schema_validator/j_schema.rb +34 -0
- data/lib/json_schema_validator/json-schema.rb +51 -0
- data/lib/json_schema_validator/json_schema.rb +37 -0
- data/lib/json_schema_validator/schema.json +150 -0
- data/lib/json_schema_validator/version.rb +3 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2947d38d89812315d76877ad1029245ba4538476
|
4
|
+
data.tar.gz: 48f564c42e4c67e9de81ad93fd4d9510157e9a7e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c57cf69a540fa51ac2e2eb1345c84f7c91a0c7b54c1461648c460fa724040435d9bcfb2188a428ce85618edb69213daa874f795ec912d3cabc9fa37ff873c28
|
7
|
+
data.tar.gz: 6ec318030a2695311fc3075379fe69b7bd8e3df0ca47667c24d3cdfa0a629fa5e4759bf9692259c9b768b3d364e77591d9a5cb99f9e072bed0a456d0813c081a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# JsonSchemaValidator
|
2
|
+
|
3
|
+
This gem provides methods to run a schema, through any available Schema
|
4
|
+
Validators for Ruby.
|
5
|
+
|
6
|
+
They should be valid according to draft-4 ...
|
7
|
+
|
8
|
+
The schema validators currently being considered are:
|
9
|
+
|
10
|
+
* https://github.com/ruby-json-schema/json-schema
|
11
|
+
* https://github.com/brandur/json_schema (note the underscore!)
|
12
|
+
* https://github.com/Soylent/jschema
|
13
|
+
|
14
|
+
These are the three currently available ruby validators that support draft-4. (According to json-schema.org).
|
15
|
+
|
16
|
+
Each validator gem has its quirks, we'll try to:
|
17
|
+
|
18
|
+
* use each to validate a schema against the json-schema meta-schema
|
19
|
+
* try to load each given schema as a schema for validation.
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Add this line to your application's Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'json_schema_validator'
|
27
|
+
```
|
28
|
+
|
29
|
+
And then execute:
|
30
|
+
|
31
|
+
$ bundle
|
32
|
+
|
33
|
+
Or install it yourself as:
|
34
|
+
|
35
|
+
$ gem install json_schema_validator
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
In your tests you can validate your schemas against the meta-schema with:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
schema_path = /path/to/my/schemas
|
43
|
+
errors = JsonSchemaValidator.validate_schemas(schema_path)
|
44
|
+
# each schema validator adds his own error message
|
45
|
+
errors.each do |name, error|
|
46
|
+
expect(error).to be_empty
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
## TODO
|
51
|
+
|
52
|
+
Not perfect yet, since it was extracted from the gem fidor_schema. For now you
|
53
|
+
need to read the code to find out about the detailed usage.
|
54
|
+
|
55
|
+
* improve log output / handling
|
56
|
+
* HowTO on validate data against the schema-draft v4 meta schema
|
57
|
+
* add tests
|
58
|
+
|
59
|
+
## Development
|
60
|
+
|
61
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests.
|
62
|
+
|
63
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
64
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/fidor/json_schema_validator
|
69
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "json_schema_validator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'json_schema_validator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "json_schema_validator"
|
8
|
+
spec.version = JsonSchemaValidator::VERSION
|
9
|
+
spec.authors = ["Georg Leciejewski, Tim Becker"]
|
10
|
+
spec.email = ["leciejewski@fidor.de"]
|
11
|
+
|
12
|
+
spec.summary = %q{Helper methods to validate json schemata against the core meta schema.}
|
13
|
+
spec.description = %q{Uses three different ruby schema gems to be as precise as possible}
|
14
|
+
spec.homepage = "https://github.com/fidor/json_schema_validator"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec"
|
32
|
+
|
33
|
+
#The different ruby schema gems
|
34
|
+
|
35
|
+
# most downloads on rubygems, last updated feb 2015
|
36
|
+
spec.add_dependency 'json-schema'
|
37
|
+
# 2nd most downloads on rubygems, last updated March 2015
|
38
|
+
spec.add_dependency 'json_schema'
|
39
|
+
# pretty new , last udpate sep 2014
|
40
|
+
spec.add_dependency 'jschema'
|
41
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "json_schema_validator/version"
|
2
|
+
require 'json_schema_validator/base'
|
3
|
+
require 'json_schema_validator/json-schema'
|
4
|
+
require 'json_schema_validator/json_schema'
|
5
|
+
require 'json_schema_validator/j_schema'
|
6
|
+
|
7
|
+
module JsonSchemaValidator
|
8
|
+
|
9
|
+
# @param [String] path to schema files
|
10
|
+
def self.validate_schemas(schema_path, validators=nil)
|
11
|
+
res = {}
|
12
|
+
available_validators = [Json_Schema, JsonSchema, JSchema]
|
13
|
+
validators ||= available_validators
|
14
|
+
files = Dir.glob("#{schema_path}/**/*.json")
|
15
|
+
validators.each do |validator|
|
16
|
+
i = validator.new files
|
17
|
+
i.validate_schemas
|
18
|
+
res[validator.to_s] = i.errors unless i.errors.empty?
|
19
|
+
end
|
20
|
+
res
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param [Symbol] validator to use
|
24
|
+
def self.run(schema_path, validators=nil)
|
25
|
+
res = {}
|
26
|
+
available_validators = [:underscore, :dash, :jschema]
|
27
|
+
validators ||= available_validators
|
28
|
+
files = Dir.glob("#{schema_path}/**/*.json")
|
29
|
+
validators.each do |validator|
|
30
|
+
case validator
|
31
|
+
when :underscore
|
32
|
+
res[validator] = Json_Schema.run files
|
33
|
+
when :dash
|
34
|
+
res[validator] = JsonSchema.run files
|
35
|
+
when :jschema
|
36
|
+
res[validator] = JSchema.run files
|
37
|
+
else
|
38
|
+
puts "Unknown validator: #{validator}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
res
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# This functionality is intended to run the schema, through
|
2
|
+
# any available Schema Validators for Ruby.
|
3
|
+
#
|
4
|
+
# They should be valid according to draft-4 ...
|
5
|
+
#
|
6
|
+
# The schema validators currently being considered are:
|
7
|
+
#
|
8
|
+
# https://github.com/ruby-json-schema/json-schema
|
9
|
+
# https://github.com/brandur/json_schema (note the underscore!)
|
10
|
+
# https://github.com/Soylent/jschema
|
11
|
+
#
|
12
|
+
# These are the three currently available ruby validators that
|
13
|
+
# support draft-4. (According to json-schema.org).
|
14
|
+
#
|
15
|
+
# Each has their quirks, we'll try to:
|
16
|
+
# * use each to validate each given schema against the json-schema meta-schema
|
17
|
+
# * try to load each given schema as a schema for validation.
|
18
|
+
#
|
19
|
+
require 'pathname'
|
20
|
+
|
21
|
+
module JsonSchemaValidator
|
22
|
+
class Base
|
23
|
+
# @return [Array<String>] file paths
|
24
|
+
attr_accessor :files_to_validate
|
25
|
+
|
26
|
+
# Run the given validator with all schema files
|
27
|
+
def self.run(files)
|
28
|
+
v = new(files)
|
29
|
+
v.log << "Running validation with #{name} for #{files.length} schemas"
|
30
|
+
v.validate_all
|
31
|
+
v
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate_all
|
35
|
+
validate_schemas
|
36
|
+
validate_data
|
37
|
+
end
|
38
|
+
|
39
|
+
def validate_schemas
|
40
|
+
files_to_validate.each do |file|
|
41
|
+
schema = File.read file
|
42
|
+
log << "validate schema: #{file}"
|
43
|
+
validate schema
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def validate_data
|
48
|
+
files_to_validate.each do |file|
|
49
|
+
schema = File.read file
|
50
|
+
log << "validate data against: #{file}"
|
51
|
+
use_for_validation schema
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Joins the logs before display
|
56
|
+
def log_fmt
|
57
|
+
res = []
|
58
|
+
if errors.length > 0
|
59
|
+
res << "#{errors.join("\n\n")}"
|
60
|
+
res << "="*50
|
61
|
+
res << "#{errors.length} with errors"
|
62
|
+
end
|
63
|
+
res << "#{success.uniq.length} Schemas passed"
|
64
|
+
res.join("\n")
|
65
|
+
end
|
66
|
+
# @return [Array<String>] error schemas
|
67
|
+
def errors
|
68
|
+
@errors ||= []
|
69
|
+
end
|
70
|
+
# @return [Array<String>] test log
|
71
|
+
def log
|
72
|
+
@log ||= []
|
73
|
+
end
|
74
|
+
# @return [Array<String>] successfull schema titles
|
75
|
+
def success
|
76
|
+
@success ||= []
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'jschema'
|
2
|
+
module JsonSchemaValidator
|
3
|
+
class JSchema < Base
|
4
|
+
|
5
|
+
def initialize(files_to_validate)
|
6
|
+
@files_to_validate = files_to_validate
|
7
|
+
schema_data = File.read("#{File.dirname(__FILE__)}/schema.json")
|
8
|
+
schema_json = JSON.parse(schema_data)
|
9
|
+
@meta_schema = ::JSchema.build(schema_json)
|
10
|
+
end
|
11
|
+
|
12
|
+
def validate(schema)
|
13
|
+
schema_to_test = JSON.parse(schema)
|
14
|
+
result = @meta_schema.validate schema_to_test
|
15
|
+
if !result || result.length == 0
|
16
|
+
success << schema_to_test['title'] || schema_to_test.keys[0]
|
17
|
+
else
|
18
|
+
errors << "Schema validation failed: #{schema_to_test['title']}\n#{result.join("\n")}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def use_for_validation(schema)
|
23
|
+
schema_to_test = JSON.parse(schema)
|
24
|
+
begin
|
25
|
+
::JSchema.build(schema_to_test)
|
26
|
+
rescue
|
27
|
+
errors << "Data validation failed: #{schema_to_test['title']}\n#{$!}"
|
28
|
+
# puts $!.backtrace
|
29
|
+
else
|
30
|
+
success << schema_to_test['title'] || schema_to_test.keys[0]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'json-schema'
|
2
|
+
# https://github.com/ruby-json-schema/json-schema
|
3
|
+
module JsonSchemaValidator
|
4
|
+
class JsonSchema < Base
|
5
|
+
def initialize(files_to_validate)
|
6
|
+
@files_to_validate = files_to_validate
|
7
|
+
@meta_schema_path = "#{File.dirname(__FILE__)}/schema.json"
|
8
|
+
|
9
|
+
# need to know the base dir of the schema to resolve relative uris.
|
10
|
+
# see below.
|
11
|
+
@schemadir = File.dirname(@files_to_validate[0])
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [String] schema to test against the meta schema
|
15
|
+
def validate(schema)
|
16
|
+
schema_to_test = JSON.parse(schema)
|
17
|
+
begin
|
18
|
+
result = JSON::Validator.fully_validate(@meta_schema_path, schema_to_test)
|
19
|
+
if !result || result.length == 0
|
20
|
+
success << schema_to_test['title'] || schema_to_test.keys[0]
|
21
|
+
else
|
22
|
+
errors << "Schema validation failed: #{schema_to_test['title']}\n#{result.join("\n")}"
|
23
|
+
end
|
24
|
+
rescue => e
|
25
|
+
errors << "Schema validation failed: #{schema_to_test['title']}\n#{e}"
|
26
|
+
# puts e.backtrace
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def use_for_validation(schema)
|
31
|
+
schema_to_test = JSON.parse(schema)
|
32
|
+
|
33
|
+
# json-schema resolves relatives path relative to it's own "."
|
34
|
+
# not relative to the file containing the reference ...
|
35
|
+
base_dir = Dir.pwd
|
36
|
+
|
37
|
+
begin
|
38
|
+
Dir.chdir @schemadir
|
39
|
+
data = {}
|
40
|
+
result = JSON::Validator.fully_validate(schema_to_test, data)
|
41
|
+
if !result || result.length == 0
|
42
|
+
success << schema_to_test['title']
|
43
|
+
else
|
44
|
+
errors << "Data validation failed: #{schema_to_test['title']}\n#{result.join("\n")}"
|
45
|
+
end
|
46
|
+
ensure
|
47
|
+
Dir.chdir base_dir
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'json_schema'
|
2
|
+
module JsonSchemaValidator
|
3
|
+
class Json_Schema < Base
|
4
|
+
|
5
|
+
def initialize(files_to_validate)
|
6
|
+
@files_to_validate = files_to_validate
|
7
|
+
schema_data = File.read("#{File.dirname(__FILE__)}/schema.json")
|
8
|
+
schema_json = JSON.parse(schema_data)
|
9
|
+
@schema = ::JsonSchema.parse!(schema_json)
|
10
|
+
@errors, @success = [], []
|
11
|
+
end
|
12
|
+
|
13
|
+
# @param [String] schema to test against the meta schema
|
14
|
+
def validate(schema)
|
15
|
+
schema_to_test = JSON.parse(schema)
|
16
|
+
begin
|
17
|
+
@schema.validate! schema_to_test
|
18
|
+
rescue
|
19
|
+
errors << "Schema validation failed: #{schema_to_test['title']}\n#{$!}"
|
20
|
+
else
|
21
|
+
success << File.basename(schema)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def use_for_validation(schema)
|
26
|
+
schema_to_test = JSON.parse(schema)
|
27
|
+
begin
|
28
|
+
::JsonSchema.parse!(schema_to_test)
|
29
|
+
rescue
|
30
|
+
errors << "Data validation failed: #{schema_to_test['title']}\n#{$!}"
|
31
|
+
else
|
32
|
+
success << schema_to_test['title']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
{
|
2
|
+
"id": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
4
|
+
"description": "Core schema meta-schema",
|
5
|
+
"definitions": {
|
6
|
+
"schemaArray": {
|
7
|
+
"type": "array",
|
8
|
+
"minItems": 1,
|
9
|
+
"items": { "$ref": "#" }
|
10
|
+
},
|
11
|
+
"positiveInteger": {
|
12
|
+
"type": "integer",
|
13
|
+
"minimum": 0
|
14
|
+
},
|
15
|
+
"positiveIntegerDefault0": {
|
16
|
+
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
|
17
|
+
},
|
18
|
+
"simpleTypes": {
|
19
|
+
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
|
20
|
+
},
|
21
|
+
"stringArray": {
|
22
|
+
"type": "array",
|
23
|
+
"items": { "type": "string" },
|
24
|
+
"minItems": 1,
|
25
|
+
"uniqueItems": true
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"type": "object",
|
29
|
+
"properties": {
|
30
|
+
"id": {
|
31
|
+
"type": "string",
|
32
|
+
"format": "uri"
|
33
|
+
},
|
34
|
+
"$schema": {
|
35
|
+
"type": "string",
|
36
|
+
"format": "uri"
|
37
|
+
},
|
38
|
+
"title": {
|
39
|
+
"type": "string"
|
40
|
+
},
|
41
|
+
"description": {
|
42
|
+
"type": "string"
|
43
|
+
},
|
44
|
+
"default": {},
|
45
|
+
"multipleOf": {
|
46
|
+
"type": "number",
|
47
|
+
"minimum": 0,
|
48
|
+
"exclusiveMinimum": true
|
49
|
+
},
|
50
|
+
"maximum": {
|
51
|
+
"type": "number"
|
52
|
+
},
|
53
|
+
"exclusiveMaximum": {
|
54
|
+
"type": "boolean",
|
55
|
+
"default": false
|
56
|
+
},
|
57
|
+
"minimum": {
|
58
|
+
"type": "number"
|
59
|
+
},
|
60
|
+
"exclusiveMinimum": {
|
61
|
+
"type": "boolean",
|
62
|
+
"default": false
|
63
|
+
},
|
64
|
+
"maxLength": { "$ref": "#/definitions/positiveInteger" },
|
65
|
+
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
66
|
+
"pattern": {
|
67
|
+
"type": "string",
|
68
|
+
"format": "regex"
|
69
|
+
},
|
70
|
+
"additionalItems": {
|
71
|
+
"anyOf": [
|
72
|
+
{ "type": "boolean" },
|
73
|
+
{ "$ref": "#" }
|
74
|
+
],
|
75
|
+
"default": {}
|
76
|
+
},
|
77
|
+
"items": {
|
78
|
+
"anyOf": [
|
79
|
+
{ "$ref": "#" },
|
80
|
+
{ "$ref": "#/definitions/schemaArray" }
|
81
|
+
],
|
82
|
+
"default": {}
|
83
|
+
},
|
84
|
+
"maxItems": { "$ref": "#/definitions/positiveInteger" },
|
85
|
+
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
86
|
+
"uniqueItems": {
|
87
|
+
"type": "boolean",
|
88
|
+
"default": false
|
89
|
+
},
|
90
|
+
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
|
91
|
+
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
92
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
93
|
+
"additionalProperties": {
|
94
|
+
"anyOf": [
|
95
|
+
{ "type": "boolean" },
|
96
|
+
{ "$ref": "#" }
|
97
|
+
],
|
98
|
+
"default": {}
|
99
|
+
},
|
100
|
+
"definitions": {
|
101
|
+
"type": "object",
|
102
|
+
"additionalProperties": { "$ref": "#" },
|
103
|
+
"default": {}
|
104
|
+
},
|
105
|
+
"properties": {
|
106
|
+
"type": "object",
|
107
|
+
"additionalProperties": { "$ref": "#" },
|
108
|
+
"default": {}
|
109
|
+
},
|
110
|
+
"patternProperties": {
|
111
|
+
"type": "object",
|
112
|
+
"additionalProperties": { "$ref": "#" },
|
113
|
+
"default": {}
|
114
|
+
},
|
115
|
+
"dependencies": {
|
116
|
+
"type": "object",
|
117
|
+
"additionalProperties": {
|
118
|
+
"anyOf": [
|
119
|
+
{ "$ref": "#" },
|
120
|
+
{ "$ref": "#/definitions/stringArray" }
|
121
|
+
]
|
122
|
+
}
|
123
|
+
},
|
124
|
+
"enum": {
|
125
|
+
"type": "array",
|
126
|
+
"minItems": 1,
|
127
|
+
"uniqueItems": true
|
128
|
+
},
|
129
|
+
"type": {
|
130
|
+
"anyOf": [
|
131
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
132
|
+
{
|
133
|
+
"type": "array",
|
134
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
135
|
+
"minItems": 1,
|
136
|
+
"uniqueItems": true
|
137
|
+
}
|
138
|
+
]
|
139
|
+
},
|
140
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
141
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
142
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
143
|
+
"not": { "$ref": "#" }
|
144
|
+
},
|
145
|
+
"dependencies": {
|
146
|
+
"exclusiveMaximum": [ "maximum" ],
|
147
|
+
"exclusiveMinimum": [ "minimum" ]
|
148
|
+
},
|
149
|
+
"default": {}
|
150
|
+
}
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: json_schema_validator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Georg Leciejewski, Tim Becker
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json-schema
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json_schema
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jschema
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Uses three different ruby schema gems to be as precise as possible
|
98
|
+
email:
|
99
|
+
- leciejewski@fidor.de
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- bin/console
|
111
|
+
- bin/setup
|
112
|
+
- json_schema_validator.gemspec
|
113
|
+
- lib/json_schema_validator.rb
|
114
|
+
- lib/json_schema_validator/base.rb
|
115
|
+
- lib/json_schema_validator/j_schema.rb
|
116
|
+
- lib/json_schema_validator/json-schema.rb
|
117
|
+
- lib/json_schema_validator/json_schema.rb
|
118
|
+
- lib/json_schema_validator/schema.json
|
119
|
+
- lib/json_schema_validator/version.rb
|
120
|
+
homepage: https://github.com/fidor/json_schema_validator
|
121
|
+
licenses: []
|
122
|
+
metadata:
|
123
|
+
allowed_push_host: https://rubygems.org
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.2.2
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Helper methods to validate json schemata against the core meta schema.
|
144
|
+
test_files: []
|