dry-validation 0.10.7 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -6
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +2 -0
- data/dry-validation.gemspec +1 -1
- data/lib/dry/validation/input_processor_compiler.rb +19 -15
- data/lib/dry/validation/input_processor_compiler/form.rb +2 -2
- data/lib/dry/validation/input_processor_compiler/json.rb +2 -2
- data/lib/dry/validation/input_processor_compiler/sanitizer.rb +2 -2
- data/lib/dry/validation/version.rb +1 -1
- metadata +6 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af9da55418a70694a1054cc6fc125bffccf37d1a
|
4
|
+
data.tar.gz: cef2923c24927ee14feddb382fc90dd2b282a513
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b1355d156e1ff29e6b76a216c31c87c1c997f62b7557f4c1613b7a512b5fe15490d3d62cd26dc61e2e1aa313c26e4d1a801dc5dd16b25336aaf38e5a6bbc23e
|
7
|
+
data.tar.gz: 8a381ddab628f2c79c0d506bd41ff91a796397c33f8b1f6449db6f3cbeee997cca427b5ac09b4169540c26efc2d38a884459d7f31d522de5488aeac2e20f3d45
|
data/.travis.yml
CHANGED
@@ -8,19 +8,14 @@ after_success:
|
|
8
8
|
script:
|
9
9
|
- bundle exec rake
|
10
10
|
rvm:
|
11
|
-
- 2.1
|
12
11
|
- 2.2
|
13
12
|
- 2.3
|
14
|
-
- 2.4.
|
13
|
+
- 2.4.1
|
15
14
|
- jruby-9.1.5.0
|
16
|
-
- rbx-3
|
17
15
|
env:
|
18
16
|
global:
|
19
17
|
- COVERAGE=true
|
20
18
|
- JRUBY_OPTS='--dev -J-Xmx1024M'
|
21
|
-
matrix:
|
22
|
-
allow_failures:
|
23
|
-
- rvm: rbx-3
|
24
19
|
notifications:
|
25
20
|
email: false
|
26
21
|
webhooks:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v0.11.0 2017-05-30
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
|
5
|
+
* [internal] input processor compilers have been updated to work with new dry-types' AST (GustavoCaso)
|
6
|
+
|
7
|
+
[Compare v0.10.7...v0.11.0](https://github.com/dry-rb/dry-validation/compare/v0.10.7...v0.11.0)
|
8
|
+
|
1
9
|
# v0.10.7 2017-05-15
|
2
10
|
|
3
11
|
### Fixed
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Issue Guidelines
|
2
|
+
|
3
|
+
## Reporting bugs
|
4
|
+
|
5
|
+
If you found a bug, report an issue and describe what's the expected behavior versus what actually happens. If the bug causes a crash, attach a full backtrace. If possible, a reproduction script showing the problem is highly appreciated.
|
6
|
+
|
7
|
+
## Reporting feature requests
|
8
|
+
|
9
|
+
Report a feature request **only after discussing it first on [discuss.dry-rb.org](https://discuss.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
|
10
|
+
|
11
|
+
## Reporting questions, support requests, ideas, concerns etc.
|
12
|
+
|
13
|
+
**PLEASE DON'T** - use [discuss.dry-rb.org](http://discuss.dry-rb.org) instead.
|
14
|
+
|
15
|
+
# Pull Request Guidelines
|
16
|
+
|
17
|
+
A Pull Request will only be accepted if it addresses a specific issue that was reported previously, or fixes typos, mistakes in documentation etc.
|
18
|
+
|
19
|
+
Other requirements:
|
20
|
+
|
21
|
+
1) Do not open a pull request if you can't provide tests along with it. If you have problems writing tests, ask for help in the related issue.
|
22
|
+
2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
|
23
|
+
3) Add API documentation if it's a new feature
|
24
|
+
4) Update API documentation if it changes an existing feature
|
25
|
+
5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](github.com/dry-rb/dry-rb.org) which updates user documentation and guides
|
26
|
+
|
27
|
+
# Asking for help
|
28
|
+
|
29
|
+
If these guidelines aren't helpful, and you're stuck, please post a message on [discuss.dry-rb.org](https://discuss.dry-rb.org).
|
data/Gemfile
CHANGED
data/dry-validation.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_runtime_dependency 'dry-configurable', '~> 0.1', '>= 0.1.3'
|
20
20
|
spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
|
21
21
|
spec.add_runtime_dependency 'dry-logic', '~> 0.4', '>= 0.4.0'
|
22
|
-
spec.add_runtime_dependency 'dry-types', '~> 0.
|
22
|
+
spec.add_runtime_dependency 'dry-types', '~> 0.11.0'
|
23
23
|
spec.add_runtime_dependency 'dry-core', '~> 0.2', '>= 0.2.1'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler'
|
@@ -6,7 +6,7 @@ module Dry
|
|
6
6
|
class InputProcessorCompiler
|
7
7
|
attr_reader :type_compiler
|
8
8
|
|
9
|
-
DEFAULT_TYPE_NODE = [
|
9
|
+
DEFAULT_TYPE_NODE = [:definition, [String, {}]].freeze
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
@type_compiler = Dry::Types::Compiler.new(Dry::Types)
|
@@ -31,21 +31,24 @@ module Dry
|
|
31
31
|
|
32
32
|
def visit_type(type, *args)
|
33
33
|
if type.is_a?(Types::Constructor)
|
34
|
-
|
34
|
+
constructor(type)
|
35
35
|
elsif type.respond_to?(:rule)
|
36
36
|
visit(type.rule.to_ast, *args)
|
37
|
-
else
|
38
|
-
DEFAULT_TYPE_NODE.first
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
40
|
+
def constructor(type)
|
41
|
+
fn_id = type.__send__(:register_fn, type.fn)
|
42
|
+
[:constructor, [[:definition, [type.primitive, {}]], fn_id, {}]]
|
43
|
+
end
|
44
|
+
|
42
45
|
def visit_schema(schema, *args)
|
43
46
|
hash_node(schema.input_processor_ast(identifier))
|
44
47
|
end
|
45
48
|
|
46
49
|
def visit_or(node, *args)
|
47
50
|
left, right = node
|
48
|
-
[:sum, [visit(left, *args), visit(right, *args)]]
|
51
|
+
[:sum, [visit(left, *args), visit(right, *args), {}]]
|
49
52
|
end
|
50
53
|
|
51
54
|
def visit_and(node, first = true)
|
@@ -55,7 +58,7 @@ module Dry
|
|
55
58
|
if name.is_a?(Array)
|
56
59
|
type
|
57
60
|
else
|
58
|
-
[:
|
61
|
+
[:member, [name, type]]
|
59
62
|
end
|
60
63
|
else
|
61
64
|
result = node.map { |n| visit(n, first) }.uniq
|
@@ -63,7 +66,7 @@ module Dry
|
|
63
66
|
if result.size == 1
|
64
67
|
result.first
|
65
68
|
else
|
66
|
-
|
69
|
+
result.select { |r| r != self.class::DEFAULT_TYPE_NODE }.last
|
67
70
|
end
|
68
71
|
end
|
69
72
|
end
|
@@ -74,9 +77,9 @@ module Dry
|
|
74
77
|
key = visit(left)
|
75
78
|
|
76
79
|
if key.is_a?(Symbol)
|
77
|
-
[:
|
80
|
+
[:member, [key, visit(right, false)]]
|
78
81
|
else
|
79
|
-
[:sum, [key, visit(right, false)]]
|
82
|
+
[:sum, [key, visit(right, false), {}]]
|
80
83
|
end
|
81
84
|
end
|
82
85
|
|
@@ -114,12 +117,13 @@ module Dry
|
|
114
117
|
def type(predicate, args)
|
115
118
|
default = self.class::PREDICATE_MAP[:default]
|
116
119
|
|
117
|
-
if predicate == :type?
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
type_value = if predicate == :type?
|
121
|
+
const = args[0]
|
122
|
+
self.class::CONST_MAP[const] || Types.identifier(const)
|
123
|
+
else
|
124
|
+
self.class::PREDICATE_MAP[predicate] || default
|
125
|
+
end
|
126
|
+
Types[type_value].to_ast
|
123
127
|
end
|
124
128
|
end
|
125
129
|
end
|
@@ -38,11 +38,11 @@ module Dry
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def hash_node(schema)
|
41
|
-
[:
|
41
|
+
[:form_hash, [schema, {}]]
|
42
42
|
end
|
43
43
|
|
44
44
|
def array_node(members)
|
45
|
-
[:
|
45
|
+
[:form_array, [members, {}]]
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -34,11 +34,11 @@ module Dry
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def hash_node(schema)
|
37
|
-
[:
|
37
|
+
[:json_hash, [schema, {}]]
|
38
38
|
end
|
39
39
|
|
40
40
|
def array_node(members)
|
41
|
-
[:
|
41
|
+
[:json_array, [members, {}]]
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Holland
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -85,20 +85,14 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
-
- - ">="
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: 0.9.0
|
88
|
+
version: 0.11.0
|
92
89
|
type: :runtime
|
93
90
|
prerelease: false
|
94
91
|
version_requirements: !ruby/object:Gem::Requirement
|
95
92
|
requirements:
|
96
93
|
- - "~>"
|
97
94
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
99
|
-
- - ">="
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 0.9.0
|
95
|
+
version: 0.11.0
|
102
96
|
- !ruby/object:Gem::Dependency
|
103
97
|
name: dry-core
|
104
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,6 +168,7 @@ files:
|
|
174
168
|
- ".rspec"
|
175
169
|
- ".travis.yml"
|
176
170
|
- CHANGELOG.md
|
171
|
+
- CONTRIBUTING.md
|
177
172
|
- Gemfile
|
178
173
|
- LICENSE
|
179
174
|
- README.md
|
@@ -373,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
373
368
|
version: '0'
|
374
369
|
requirements: []
|
375
370
|
rubyforge_project:
|
376
|
-
rubygems_version: 2.6.
|
371
|
+
rubygems_version: 2.6.12
|
377
372
|
signing_key:
|
378
373
|
specification_version: 4
|
379
374
|
summary: A simple validation library
|