schemacop 3.0.27 → 3.0.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/schemacop.rb +1 -2
- data/schemacop.gemspec +3 -3
- data/test/unit/schemacop/v3/string_node_test.rb +58 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff2b18b4f3426f6a06e4a9183c3b20375c5d55496929bdf30a569c19ad1cc28c
|
4
|
+
data.tar.gz: edb96299b93d5e49b6d5a8125fa2c95a73d6158c2cae4d4428c3fe9066b41244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b290cbf2a7fdfc4b938fbdad9d4bd54469867fa46be22dc1a2158c32fe68266d1cce136d824a263689b9fdd9797ddfd601c7fa9fafbd37bb9adf3634f126ba
|
7
|
+
data.tar.gz: 73241d7daed75ad77a230904821749dcb0e954f8c3c858bc207d9487dd4b7cffbe806ea7a64dffc28010e6dc27281133d5191129781ad2c462dbe2f395b76278
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.28
|
data/lib/schemacop.rb
CHANGED
@@ -57,10 +57,9 @@ module Schemacop
|
|
57
57
|
|
58
58
|
register_string_formatter(
|
59
59
|
:mailbox,
|
60
|
-
pattern:
|
60
|
+
pattern: /^("\p{Print}+"\s)?<#{URI::MailTo::EMAIL_REGEXP.source[2...-2]}>$/,
|
61
61
|
handler: ->(value) { value }
|
62
62
|
)
|
63
|
-
|
64
63
|
register_string_formatter(
|
65
64
|
:boolean,
|
66
65
|
pattern: /^(true|false|0|1)$/i,
|
data/schemacop.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: schemacop 3.0.
|
2
|
+
# stub: schemacop 3.0.28 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "schemacop".freeze
|
6
|
-
s.version = "3.0.
|
6
|
+
s.version = "3.0.28".freeze
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Sitrox".freeze]
|
11
|
-
s.date = "2023-12-
|
11
|
+
s.date = "2023-12-20"
|
12
12
|
s.files = [".github/workflows/ruby.yml".freeze, ".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, ".yardopts".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "README_V2.md".freeze, "README_V3.md".freeze, "RUBY_VERSION".freeze, "Rakefile".freeze, "VERSION".freeze, "lib/schemacop.rb".freeze, "lib/schemacop/base_schema.rb".freeze, "lib/schemacop/exceptions.rb".freeze, "lib/schemacop/railtie.rb".freeze, "lib/schemacop/schema.rb".freeze, "lib/schemacop/schema2.rb".freeze, "lib/schemacop/schema3.rb".freeze, "lib/schemacop/scoped_env.rb".freeze, "lib/schemacop/v2.rb".freeze, "lib/schemacop/v2/caster.rb".freeze, "lib/schemacop/v2/collector.rb".freeze, "lib/schemacop/v2/dupper.rb".freeze, "lib/schemacop/v2/field_node.rb".freeze, "lib/schemacop/v2/node.rb".freeze, "lib/schemacop/v2/node_resolver.rb".freeze, "lib/schemacop/v2/node_supporting_field.rb".freeze, "lib/schemacop/v2/node_supporting_type.rb".freeze, "lib/schemacop/v2/node_with_block.rb".freeze, "lib/schemacop/v2/validator/array_validator.rb".freeze, "lib/schemacop/v2/validator/boolean_validator.rb".freeze, "lib/schemacop/v2/validator/float_validator.rb".freeze, "lib/schemacop/v2/validator/hash_validator.rb".freeze, "lib/schemacop/v2/validator/integer_validator.rb".freeze, "lib/schemacop/v2/validator/nil_validator.rb".freeze, "lib/schemacop/v2/validator/number_validator.rb".freeze, "lib/schemacop/v2/validator/object_validator.rb".freeze, "lib/schemacop/v2/validator/string_validator.rb".freeze, "lib/schemacop/v2/validator/symbol_validator.rb".freeze, "lib/schemacop/v3.rb".freeze, "lib/schemacop/v3/all_of_node.rb".freeze, "lib/schemacop/v3/any_of_node.rb".freeze, "lib/schemacop/v3/array_node.rb".freeze, "lib/schemacop/v3/boolean_node.rb".freeze, "lib/schemacop/v3/combination_node.rb".freeze, "lib/schemacop/v3/context.rb".freeze, "lib/schemacop/v3/dsl_scope.rb".freeze, "lib/schemacop/v3/global_context.rb".freeze, "lib/schemacop/v3/hash_node.rb".freeze, "lib/schemacop/v3/integer_node.rb".freeze, "lib/schemacop/v3/is_not_node.rb".freeze, "lib/schemacop/v3/node.rb".freeze, "lib/schemacop/v3/node_registry.rb".freeze, "lib/schemacop/v3/number_node.rb".freeze, "lib/schemacop/v3/numeric_node.rb".freeze, "lib/schemacop/v3/object_node.rb".freeze, "lib/schemacop/v3/one_of_node.rb".freeze, "lib/schemacop/v3/reference_node.rb".freeze, "lib/schemacop/v3/result.rb".freeze, "lib/schemacop/v3/string_node.rb".freeze, "lib/schemacop/v3/symbol_node.rb".freeze, "schemacop.gemspec".freeze, "test/lib/test_helper.rb".freeze, "test/schemas/nested/group.rb".freeze, "test/schemas/user.rb".freeze, "test/unit/schemacop/v2/casting_test.rb".freeze, "test/unit/schemacop/v2/collector_test.rb".freeze, "test/unit/schemacop/v2/custom_check_test.rb".freeze, "test/unit/schemacop/v2/custom_if_test.rb".freeze, "test/unit/schemacop/v2/defaults_test.rb".freeze, "test/unit/schemacop/v2/empty_test.rb".freeze, "test/unit/schemacop/v2/nil_dis_allow_test.rb".freeze, "test/unit/schemacop/v2/node_resolver_test.rb".freeze, "test/unit/schemacop/v2/short_forms_test.rb".freeze, "test/unit/schemacop/v2/types_test.rb".freeze, "test/unit/schemacop/v2/validator_array_test.rb".freeze, "test/unit/schemacop/v2/validator_boolean_test.rb".freeze, "test/unit/schemacop/v2/validator_float_test.rb".freeze, "test/unit/schemacop/v2/validator_hash_test.rb".freeze, "test/unit/schemacop/v2/validator_integer_test.rb".freeze, "test/unit/schemacop/v2/validator_nil_test.rb".freeze, "test/unit/schemacop/v2/validator_number_test.rb".freeze, "test/unit/schemacop/v2/validator_object_test.rb".freeze, "test/unit/schemacop/v2/validator_string_test.rb".freeze, "test/unit/schemacop/v2/validator_symbol_test.rb".freeze, "test/unit/schemacop/v3/all_of_node_test.rb".freeze, "test/unit/schemacop/v3/any_of_node_test.rb".freeze, "test/unit/schemacop/v3/array_node_test.rb".freeze, "test/unit/schemacop/v3/boolean_node_test.rb".freeze, "test/unit/schemacop/v3/global_context_test.rb".freeze, "test/unit/schemacop/v3/hash_node_test.rb".freeze, "test/unit/schemacop/v3/integer_node_test.rb".freeze, "test/unit/schemacop/v3/is_not_node_test.rb".freeze, "test/unit/schemacop/v3/node_test.rb".freeze, "test/unit/schemacop/v3/number_node_test.rb".freeze, "test/unit/schemacop/v3/object_node_test.rb".freeze, "test/unit/schemacop/v3/one_of_node_test.rb".freeze, "test/unit/schemacop/v3/reference_node_test.rb".freeze, "test/unit/schemacop/v3/string_node_test.rb".freeze, "test/unit/schemacop/v3/symbol_node_test.rb".freeze]
|
13
13
|
s.homepage = "https://github.com/sitrox/schemacop".freeze
|
14
14
|
s.licenses = ["MIT".freeze]
|
@@ -196,43 +196,87 @@ module Schemacop
|
|
196
196
|
|
197
197
|
assert_json(type: :string, format: :mailbox)
|
198
198
|
|
199
|
+
# No angle brackets given
|
199
200
|
assert_validation 'john.doe@example.com' do
|
200
201
|
error '/', 'String does not match format "mailbox".'
|
201
202
|
end
|
202
203
|
|
203
|
-
|
204
|
+
# Only leading angle bracket given
|
205
|
+
assert_validation '<john.doe@example.com' do
|
204
206
|
error '/', 'String does not match format "mailbox".'
|
205
207
|
end
|
206
208
|
|
207
|
-
|
209
|
+
# Only trailing angle bracket given
|
210
|
+
assert_validation 'john.doe@example.com>' do
|
208
211
|
error '/', 'String does not match format "mailbox".'
|
209
212
|
end
|
210
213
|
|
211
|
-
|
214
|
+
# Both angle brackets given, OK
|
215
|
+
assert_validation '<john.doe@example.com>'
|
216
|
+
|
217
|
+
# Both angle brackets given but leading space, not okay
|
218
|
+
assert_validation ' <john.doe@example.com>' do
|
212
219
|
error '/', 'String does not match format "mailbox".'
|
213
220
|
end
|
214
221
|
|
215
|
-
|
222
|
+
# Invalid email address given
|
223
|
+
assert_validation ' <john>' do
|
216
224
|
error '/', 'String does not match format "mailbox".'
|
217
225
|
end
|
218
226
|
|
219
|
-
|
227
|
+
# Invalid email address given
|
228
|
+
assert_validation ' <john@>' do
|
229
|
+
error '/', 'String does not match format "mailbox".'
|
230
|
+
end
|
231
|
+
|
232
|
+
# Invalid email address given
|
233
|
+
assert_validation ' <@example.com>' do
|
234
|
+
error '/', 'String does not match format "mailbox".'
|
235
|
+
end
|
236
|
+
|
237
|
+
# Name given but no quotes
|
238
|
+
assert_validation 'John Doe <john.doe@example.com>' do
|
239
|
+
error '/', 'String does not match format "mailbox".'
|
240
|
+
end
|
241
|
+
|
242
|
+
# Name given but only leading quote
|
243
|
+
assert_validation '"John Doe <john.doe@example.com>' do
|
220
244
|
error '/', 'String does not match format "mailbox".'
|
221
245
|
end
|
222
246
|
|
223
|
-
|
224
|
-
assert_validation 'John Doe <john.doe
|
225
|
-
|
247
|
+
# Name given but only trailing quote
|
248
|
+
assert_validation 'John Doe" <john.doe@example.com>' do
|
249
|
+
error '/', 'String does not match format "mailbox".'
|
250
|
+
end
|
251
|
+
|
252
|
+
# Name given but no space between mail and name
|
253
|
+
assert_validation '"John Doe"<john.doe@example.com>' do
|
254
|
+
error '/', 'String does not match format "mailbox".'
|
255
|
+
end
|
256
|
+
|
257
|
+
# Too many brackets at start
|
258
|
+
assert_validation '"John Doe" <<john.doe@example.com>' do
|
259
|
+
error '/', 'String does not match format "mailbox".'
|
260
|
+
end
|
261
|
+
|
262
|
+
# Too many brackets at end
|
263
|
+
assert_validation '"John Doe" <john.doe@example.com>>' do
|
264
|
+
error '/', 'String does not match format "mailbox".'
|
265
|
+
end
|
226
266
|
|
227
|
-
|
228
|
-
assert_validation 'John Doe 123 <john.doe@example.com>'
|
229
|
-
assert_validation 'John_Doe <john.doe@example.com>'
|
230
|
-
assert_validation 'John-Doe ÖÄ <john.doe@example.com>'
|
267
|
+
# Name with quotes and space before mail, OK
|
231
268
|
assert_validation '"John Doe" <john.doe@example.com>'
|
232
|
-
|
269
|
+
|
270
|
+
# Name with quotes and space before mail with special characters, OK
|
271
|
+
assert_validation '"Jöhn Doé-Test" <john.doe@example.com>'
|
272
|
+
|
273
|
+
# Name with quotes and space before mail with angle bracket in name, OK
|
274
|
+
assert_validation '"John < Doe" <john.doe@example.com>'
|
233
275
|
|
234
276
|
assert_cast(nil, nil)
|
235
|
-
assert_cast('
|
277
|
+
assert_cast('<john.doe@example.com>', '<john.doe@example.com>')
|
278
|
+
assert_cast('"John Doe" <john.doe@example.com>', '"John Doe" <john.doe@example.com>')
|
279
|
+
assert_cast('"Jöhn Doé-Test" <john.doe@example.com>', '"Jöhn Doé-Test" <john.doe@example.com>')
|
236
280
|
end
|
237
281
|
|
238
282
|
def test_format_boolean
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schemacop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|