activemodel_json_validator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -3
- data/Appraisals +11 -0
- data/README.md +10 -0
- data/activemodel_json_validator.gemspec +4 -5
- data/gemfiles/activemodel_4.2.gemfile +7 -0
- data/gemfiles/activemodel_4.2.gemfile.lock +82 -0
- data/gemfiles/activemodel_5.2.gemfile +7 -0
- data/gemfiles/activemodel_5.2.gemfile.lock +80 -0
- data/gemfiles/activemodel_6.0.gemfile +7 -0
- data/gemfiles/activemodel_6.0.gemfile.lock +82 -0
- data/lib/active_model/json_validator/locale/en.yml +4 -0
- data/lib/{activemodel → active_model}/json_validator/validator.rb +0 -0
- data/lib/{activemodel → active_model}/json_validator/version.rb +1 -1
- data/lib/activemodel_json_validator.rb +6 -2
- metadata +17 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80e73e621a65a23064dfa44a9acc72a7bbb835c304d42833e3029162267d11b2
|
4
|
+
data.tar.gz: c17b97627baeb5b53889c788e89fa4b3960db837d157f70ef5ef92b16fee9bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8580a64ed6ee5fe719680940d8f7ec78a514178f13bb08947ea5ef974e4c9c83c581c8c7f34b06ef223330c97aedca8a0173c42df8f9784a01d7fae92c8f1c0f
|
7
|
+
data.tar.gz: ebd012ee13b8e0c4b4a58ac8259a62bb91b6360c96fa390d5507441a2ace45440e3b7938d3f86d1bb5a8df1aeece5bd81da3c171191d6c3201921ea19c2fc170
|
data/.travis.yml
CHANGED
@@ -3,9 +3,13 @@ cache: bundler
|
|
3
3
|
language: ruby
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
- 2.6.0
|
6
|
+
- 2.5.5
|
7
|
+
- 2.6.3
|
9
8
|
|
10
9
|
before_install:
|
11
10
|
- gem install bundler -v 2.0.2
|
11
|
+
|
12
|
+
gemfile:
|
13
|
+
- gemfiles/activemodel_4.2.gemfile
|
14
|
+
- gemfiles/activemodel_5.2.gemfile
|
15
|
+
- gemfiles/activemodel_6.0.gemfile
|
data/Appraisals
ADDED
data/README.md
CHANGED
@@ -48,6 +48,16 @@ By default this validation will find an schema in:
|
|
48
48
|
}
|
49
49
|
```
|
50
50
|
|
51
|
+
```ruby
|
52
|
+
user = User.new
|
53
|
+
user.preferences = { locale: 'en', currency: 'USD' }
|
54
|
+
user.valid? # => true
|
55
|
+
|
56
|
+
user.preferences = { currency: 100, subscribed: 'true' }
|
57
|
+
user.valid? # => false
|
58
|
+
user.errors[:preferences] # => Invalid json
|
59
|
+
```
|
60
|
+
|
51
61
|
Custom schema path could be passed to the validator:
|
52
62
|
|
53
63
|
```ruby
|
@@ -1,6 +1,6 @@
|
|
1
1
|
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require '
|
3
|
+
require 'active_model/json_validator/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'activemodel_json_validator'
|
@@ -25,12 +25,11 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_development_dependency 'rake', '~>
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
28
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
30
30
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
31
|
spec.add_development_dependency 'appraisal', '~> 2.2'
|
32
|
-
spec.add_development_dependency '
|
33
|
-
spec.add_development_dependency 'coveralls', '~> 0.7.2'
|
32
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
34
33
|
|
35
34
|
spec.add_dependency 'activemodel', '>= 4.2'
|
36
35
|
spec.add_dependency 'json-schema', '~> 2.8'
|
@@ -0,0 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activemodel_json_validator (0.1.1)
|
5
|
+
activemodel (>= 4.2)
|
6
|
+
json-schema (~> 2.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (4.2.11.1)
|
12
|
+
activesupport (= 4.2.11.1)
|
13
|
+
builder (~> 3.1)
|
14
|
+
activesupport (4.2.11.1)
|
15
|
+
i18n (~> 0.7)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
18
|
+
tzinfo (~> 1.1)
|
19
|
+
addressable (2.6.0)
|
20
|
+
public_suffix (>= 2.0.2, < 4.0)
|
21
|
+
appraisal (2.2.0)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
thor (>= 0.14.0)
|
25
|
+
builder (3.2.3)
|
26
|
+
concurrent-ruby (1.1.5)
|
27
|
+
coveralls (0.8.23)
|
28
|
+
json (>= 1.8, < 3)
|
29
|
+
simplecov (~> 0.16.1)
|
30
|
+
term-ansicolor (~> 1.3)
|
31
|
+
thor (>= 0.19.4, < 2.0)
|
32
|
+
tins (~> 1.6)
|
33
|
+
diff-lcs (1.3)
|
34
|
+
docile (1.3.2)
|
35
|
+
i18n (0.9.5)
|
36
|
+
concurrent-ruby (~> 1.0)
|
37
|
+
json (2.2.0)
|
38
|
+
json-schema (2.8.1)
|
39
|
+
addressable (>= 2.4)
|
40
|
+
minitest (5.11.3)
|
41
|
+
public_suffix (3.1.1)
|
42
|
+
rake (12.3.3)
|
43
|
+
rspec (3.8.0)
|
44
|
+
rspec-core (~> 3.8.0)
|
45
|
+
rspec-expectations (~> 3.8.0)
|
46
|
+
rspec-mocks (~> 3.8.0)
|
47
|
+
rspec-core (3.8.2)
|
48
|
+
rspec-support (~> 3.8.0)
|
49
|
+
rspec-expectations (3.8.4)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.8.0)
|
52
|
+
rspec-mocks (3.8.1)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.8.0)
|
55
|
+
rspec-support (3.8.2)
|
56
|
+
simplecov (0.16.1)
|
57
|
+
docile (~> 1.1)
|
58
|
+
json (>= 1.8, < 3)
|
59
|
+
simplecov-html (~> 0.10.0)
|
60
|
+
simplecov-html (0.10.2)
|
61
|
+
term-ansicolor (1.7.1)
|
62
|
+
tins (~> 1.0)
|
63
|
+
thor (0.20.3)
|
64
|
+
thread_safe (0.3.6)
|
65
|
+
tins (1.21.1)
|
66
|
+
tzinfo (1.2.5)
|
67
|
+
thread_safe (~> 0.1)
|
68
|
+
|
69
|
+
PLATFORMS
|
70
|
+
ruby
|
71
|
+
|
72
|
+
DEPENDENCIES
|
73
|
+
activemodel (~> 4.2)
|
74
|
+
activemodel_json_validator!
|
75
|
+
appraisal (~> 2.2)
|
76
|
+
bundler (~> 2.0)
|
77
|
+
coveralls (~> 0.8)
|
78
|
+
rake (~> 12.0)
|
79
|
+
rspec (~> 3.8)
|
80
|
+
|
81
|
+
BUNDLED WITH
|
82
|
+
2.0.2
|
@@ -0,0 +1,80 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activemodel_json_validator (0.1.1)
|
5
|
+
activemodel (>= 4.2)
|
6
|
+
json-schema (~> 2.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (5.2.3)
|
12
|
+
activesupport (= 5.2.3)
|
13
|
+
activesupport (5.2.3)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 0.7, < 2)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
addressable (2.6.0)
|
19
|
+
public_suffix (>= 2.0.2, < 4.0)
|
20
|
+
appraisal (2.2.0)
|
21
|
+
bundler
|
22
|
+
rake
|
23
|
+
thor (>= 0.14.0)
|
24
|
+
concurrent-ruby (1.1.5)
|
25
|
+
coveralls (0.8.23)
|
26
|
+
json (>= 1.8, < 3)
|
27
|
+
simplecov (~> 0.16.1)
|
28
|
+
term-ansicolor (~> 1.3)
|
29
|
+
thor (>= 0.19.4, < 2.0)
|
30
|
+
tins (~> 1.6)
|
31
|
+
diff-lcs (1.3)
|
32
|
+
docile (1.3.2)
|
33
|
+
i18n (1.6.0)
|
34
|
+
concurrent-ruby (~> 1.0)
|
35
|
+
json (2.2.0)
|
36
|
+
json-schema (2.8.1)
|
37
|
+
addressable (>= 2.4)
|
38
|
+
minitest (5.11.3)
|
39
|
+
public_suffix (3.1.1)
|
40
|
+
rake (12.3.3)
|
41
|
+
rspec (3.8.0)
|
42
|
+
rspec-core (~> 3.8.0)
|
43
|
+
rspec-expectations (~> 3.8.0)
|
44
|
+
rspec-mocks (~> 3.8.0)
|
45
|
+
rspec-core (3.8.2)
|
46
|
+
rspec-support (~> 3.8.0)
|
47
|
+
rspec-expectations (3.8.4)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.8.0)
|
50
|
+
rspec-mocks (3.8.1)
|
51
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
+
rspec-support (~> 3.8.0)
|
53
|
+
rspec-support (3.8.2)
|
54
|
+
simplecov (0.16.1)
|
55
|
+
docile (~> 1.1)
|
56
|
+
json (>= 1.8, < 3)
|
57
|
+
simplecov-html (~> 0.10.0)
|
58
|
+
simplecov-html (0.10.2)
|
59
|
+
term-ansicolor (1.7.1)
|
60
|
+
tins (~> 1.0)
|
61
|
+
thor (0.20.3)
|
62
|
+
thread_safe (0.3.6)
|
63
|
+
tins (1.21.1)
|
64
|
+
tzinfo (1.2.5)
|
65
|
+
thread_safe (~> 0.1)
|
66
|
+
|
67
|
+
PLATFORMS
|
68
|
+
ruby
|
69
|
+
|
70
|
+
DEPENDENCIES
|
71
|
+
activemodel (~> 5.2)
|
72
|
+
activemodel_json_validator!
|
73
|
+
appraisal (~> 2.2)
|
74
|
+
bundler (~> 2.0)
|
75
|
+
coveralls (~> 0.8)
|
76
|
+
rake (~> 12.0)
|
77
|
+
rspec (~> 3.8)
|
78
|
+
|
79
|
+
BUNDLED WITH
|
80
|
+
2.0.2
|
@@ -0,0 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activemodel_json_validator (0.1.1)
|
5
|
+
activemodel (>= 4.2)
|
6
|
+
json-schema (~> 2.8)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (6.0.0)
|
12
|
+
activesupport (= 6.0.0)
|
13
|
+
activesupport (6.0.0)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 0.7, < 2)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
19
|
+
addressable (2.6.0)
|
20
|
+
public_suffix (>= 2.0.2, < 4.0)
|
21
|
+
appraisal (2.2.0)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
thor (>= 0.14.0)
|
25
|
+
concurrent-ruby (1.1.5)
|
26
|
+
coveralls (0.8.23)
|
27
|
+
json (>= 1.8, < 3)
|
28
|
+
simplecov (~> 0.16.1)
|
29
|
+
term-ansicolor (~> 1.3)
|
30
|
+
thor (>= 0.19.4, < 2.0)
|
31
|
+
tins (~> 1.6)
|
32
|
+
diff-lcs (1.3)
|
33
|
+
docile (1.3.2)
|
34
|
+
i18n (1.6.0)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
json (2.2.0)
|
37
|
+
json-schema (2.8.1)
|
38
|
+
addressable (>= 2.4)
|
39
|
+
minitest (5.11.3)
|
40
|
+
public_suffix (3.1.1)
|
41
|
+
rake (12.3.3)
|
42
|
+
rspec (3.8.0)
|
43
|
+
rspec-core (~> 3.8.0)
|
44
|
+
rspec-expectations (~> 3.8.0)
|
45
|
+
rspec-mocks (~> 3.8.0)
|
46
|
+
rspec-core (3.8.2)
|
47
|
+
rspec-support (~> 3.8.0)
|
48
|
+
rspec-expectations (3.8.4)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.8.0)
|
51
|
+
rspec-mocks (3.8.1)
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
+
rspec-support (~> 3.8.0)
|
54
|
+
rspec-support (3.8.2)
|
55
|
+
simplecov (0.16.1)
|
56
|
+
docile (~> 1.1)
|
57
|
+
json (>= 1.8, < 3)
|
58
|
+
simplecov-html (~> 0.10.0)
|
59
|
+
simplecov-html (0.10.2)
|
60
|
+
term-ansicolor (1.7.1)
|
61
|
+
tins (~> 1.0)
|
62
|
+
thor (0.20.3)
|
63
|
+
thread_safe (0.3.6)
|
64
|
+
tins (1.21.1)
|
65
|
+
tzinfo (1.2.5)
|
66
|
+
thread_safe (~> 0.1)
|
67
|
+
zeitwerk (2.1.9)
|
68
|
+
|
69
|
+
PLATFORMS
|
70
|
+
ruby
|
71
|
+
|
72
|
+
DEPENDENCIES
|
73
|
+
activemodel (~> 6.0)
|
74
|
+
activemodel_json_validator!
|
75
|
+
appraisal (~> 2.2)
|
76
|
+
bundler (~> 2.0)
|
77
|
+
coveralls (~> 0.8)
|
78
|
+
rake (~> 12.0)
|
79
|
+
rspec (~> 3.8)
|
80
|
+
|
81
|
+
BUNDLED WITH
|
82
|
+
2.0.2
|
File without changes
|
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'json-schema'
|
2
2
|
require 'active_model'
|
3
3
|
|
4
|
-
require '
|
5
|
-
require '
|
4
|
+
require 'active_model/json_validator/version'
|
5
|
+
require 'active_model/json_validator/validator'
|
6
|
+
|
7
|
+
ActiveSupport.on_load(:i18n) do
|
8
|
+
I18n.load_path << File.expand_path('active_model/json_validator/locale/en.yml', __dir__)
|
9
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel_json_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Gutiérrez
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '12.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '12.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
33
|
+
version: '3.8'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,34 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.2'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simplecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.17'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.17'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: coveralls
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
75
|
+
version: '0.8'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
82
|
+
version: '0.8'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: activemodel
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,6 +118,7 @@ files:
|
|
132
118
|
- ".gitignore"
|
133
119
|
- ".rspec"
|
134
120
|
- ".travis.yml"
|
121
|
+
- Appraisals
|
135
122
|
- CODE_OF_CONDUCT.md
|
136
123
|
- Gemfile
|
137
124
|
- LICENSE.txt
|
@@ -140,8 +127,15 @@ files:
|
|
140
127
|
- activemodel_json_validator.gemspec
|
141
128
|
- bin/console
|
142
129
|
- bin/setup
|
143
|
-
-
|
144
|
-
-
|
130
|
+
- gemfiles/activemodel_4.2.gemfile
|
131
|
+
- gemfiles/activemodel_4.2.gemfile.lock
|
132
|
+
- gemfiles/activemodel_5.2.gemfile
|
133
|
+
- gemfiles/activemodel_5.2.gemfile.lock
|
134
|
+
- gemfiles/activemodel_6.0.gemfile
|
135
|
+
- gemfiles/activemodel_6.0.gemfile.lock
|
136
|
+
- lib/active_model/json_validator/locale/en.yml
|
137
|
+
- lib/active_model/json_validator/validator.rb
|
138
|
+
- lib/active_model/json_validator/version.rb
|
145
139
|
- lib/activemodel_json_validator.rb
|
146
140
|
homepage: https://github.com/alejandrodevs/activemodel_json_validator
|
147
141
|
licenses:
|