json_schema 0.20.9 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e21a1e4dc51b894f1374f46872ed71f49d2b45702dc99783286aafefca69f8c8
4
- data.tar.gz: 7002f0a54a8de78318b676d9f1c0465dc8ff40d70163b3d83b8fafa412cee52e
3
+ metadata.gz: 3cef7b24665bb90268f4feaac55fedc33027cab76886b05a54be71767c55802c
4
+ data.tar.gz: d20911da20ffffdecb4c8335cc081e9bc96c6236cd350dc0b4148e1d8a351edc
5
5
  SHA512:
6
- metadata.gz: a9d51a9b64731ad8e2aa3bb79f65e3b7c555a38b181a6a00789b9025903a5049e1be0043a3637456a07d008f8878b2a61f56b3a6b9bacd90c1fc7acb20a5415a
7
- data.tar.gz: 71e615dc945f0bd926f41211e56a48424f0f45df706df4394779ebf03d96316764a0b6433b2413469e314d0c1a42d08bcc0f479c2c0b2f3736732c4815993361
6
+ metadata.gz: 79671495e3e027b3ee4b76f68d76f651fa93df94a4102569970e40c8444105b30f04b441850dda768d063cce7d091163fb7d9de37a352e9c50e2e439b8068d11
7
+ data.tar.gz: 5d331de53da190de60e53c13293a54a0e26aa56c48c4b7676725a3862cfc074aff4c56e91aca53bb7abe257e9ac60afa9a4b99ff671fb2780cfb47376cf3a03d
@@ -567,7 +567,7 @@ module JsonSchema
567
567
  end
568
568
 
569
569
  DEFAULT_FORMAT_VALIDATORS = {
570
- "date" => ->(data) { data =~ DATE_PATTERN },
570
+ "date" => ->(data) { data =~ DATE_PATTERN && Date.parse(data) rescue false },
571
571
  "date-time" => ->(data) { data =~ DATE_TIME_PATTERN },
572
572
  "email" => ->(data) { data =~ EMAIL_PATTERN },
573
573
  "hostname" => ->(data) { data =~ HOSTNAME_PATTERN },
@@ -718,6 +718,14 @@ describe JsonSchema::Validator do
718
718
  refute_valid
719
719
  end
720
720
 
721
+ it "validates date format when month and day exceed valid range unsuccessfully" do
722
+ pointer("#/definitions/app/definitions/owner").merge!(
723
+ "format" => "date"
724
+ )
725
+ data_sample["owner"] = "2014-24-60"
726
+ refute_valid
727
+ end
728
+
721
729
  it "validates date-time format successfully" do
722
730
  pointer("#/definitions/app/definitions/owner").merge!(
723
731
  "format" => "date-time"
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.9
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - brandur@mutelight.org
16
16
  executables:
@@ -54,7 +54,7 @@ homepage: https://github.com/brandur/json_schema
54
54
  licenses:
55
55
  - MIT
56
56
  metadata: {}
57
- post_install_message:
57
+ post_install_message:
58
58
  rdoc_options: []
59
59
  require_paths:
60
60
  - lib
@@ -69,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubygems_version: 3.1.4
73
- signing_key:
72
+ rubygems_version: 3.2.3
73
+ signing_key:
74
74
  specification_version: 4
75
75
  summary: A JSON Schema V4 and Hyperschema V4 parser and validator.
76
76
  test_files: []