json-schema 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -925,9 +925,9 @@ class JSONSchemaDraft3Test < Test::Unit::TestCase
925
925
 
926
926
  data = {"a" => "2010-01-01T12:00:00Z"}
927
927
  assert(JSON::Validator.validate(schema,data))
928
- data = {"a" => "2010-01-01T12:00:00.1Z"}
928
+ data = {"a" => "2010-01-01T12:00:00.1Z"}
929
929
  assert(JSON::Validator.validate(schema,data))
930
- data = {"a" => "2010-01-01T12:00:00,1Z"}
930
+ data = {"a" => "2010-01-01T12:00:00,1Z"}
931
931
  assert(JSON::Validator.validate(schema,data))
932
932
  data = {"a" => "2010-01-32T12:00:00Z"}
933
933
  assert(!JSON::Validator.validate(schema,data))
@@ -939,12 +939,43 @@ class JSONSchemaDraft3Test < Test::Unit::TestCase
939
939
  assert(!JSON::Validator.validate(schema,data))
940
940
  data = {"a" => "2010-01-01T12:00:60Z"}
941
941
  assert(!JSON::Validator.validate(schema,data))
942
- data = {"a" => "2010-01-01T12:00:00"}
943
- assert(!JSON::Validator.validate(schema,data))
944
942
  data = {"a" => "2010-01-01T12:00:00z"}
945
943
  assert(!JSON::Validator.validate(schema,data))
946
944
  data = {"a" => "2010-01-0112:00:00Z"}
947
945
  assert(!JSON::Validator.validate(schema,data))
946
+
947
+ # test with a specific timezone
948
+ data = {"a" => "2010-01-01T12:00:00+01"}
949
+ assert(JSON::Validator.validate(schema,data))
950
+ data = {"a" => "2010-01-01T12:00:00+01:00"}
951
+ assert(JSON::Validator.validate(schema,data))
952
+ data = {"a" => "2010-01-01T12:00:00+01:30"}
953
+ assert(JSON::Validator.validate(schema,data))
954
+ data = {"a" => "2010-01-01T12:00:00+0234"}
955
+ assert(!JSON::Validator.validate(schema,data))
956
+ data = {"a" => "2010-01-01T12:00:00+01:"}
957
+ assert(!JSON::Validator.validate(schema,data))
958
+ data = {"a" => "2010-01-01T12:00:00+0"}
959
+ assert(!JSON::Validator.validate(schema,data))
960
+ # do not allow mixing Z and specific timezone
961
+ data = {"a" => "2010-01-01T12:00:00Z+01"}
962
+ assert(!JSON::Validator.validate(schema,data))
963
+ data = {"a" => "2010-01-01T12:00:00+01Z"}
964
+ assert(!JSON::Validator.validate(schema,data))
965
+ data = {"a" => "2010-01-01T12:00:00+01:30Z"}
966
+ assert(!JSON::Validator.validate(schema,data))
967
+ data = {"a" => "2010-01-01T12:00:00+0Z"}
968
+ assert(!JSON::Validator.validate(schema,data))
969
+
970
+ # test without any timezone
971
+ data = {"a" => "2010-01-01T12:00:00"}
972
+ assert(JSON::Validator.validate(schema,data))
973
+ data = {"a" => "2010-01-01T12:00:00.12345"}
974
+ assert(JSON::Validator.validate(schema,data))
975
+ data = {"a" => "2010-01-01T12:00:00,12345"}
976
+ assert(JSON::Validator.validate(schema,data))
977
+ data = {"a" => "2010-01-01T12:00:00.12345"}
978
+ assert(JSON::Validator.validate(schema,data))
948
979
  end
949
980
 
950
981
 
@@ -889,9 +889,9 @@ class JSONSchemaDraft4Test < Test::Unit::TestCase
889
889
 
890
890
  data = {"a" => "2010-01-01T12:00:00Z"}
891
891
  assert(JSON::Validator.validate(schema,data))
892
- data = {"a" => "2010-01-01T12:00:00.1Z"}
892
+ data = {"a" => "2010-01-01T12:00:00.1Z"}
893
893
  assert(JSON::Validator.validate(schema,data))
894
- data = {"a" => "2010-01-01T12:00:00,1Z"}
894
+ data = {"a" => "2010-01-01T12:00:00,1Z"}
895
895
  assert(JSON::Validator.validate(schema,data))
896
896
  data = {"a" => "2010-01-32T12:00:00Z"}
897
897
  assert(!JSON::Validator.validate(schema,data))
@@ -903,8 +903,6 @@ class JSONSchemaDraft4Test < Test::Unit::TestCase
903
903
  assert(!JSON::Validator.validate(schema,data))
904
904
  data = {"a" => "2010-01-01T12:00:60Z"}
905
905
  assert(!JSON::Validator.validate(schema,data))
906
- data = {"a" => "2010-01-01T12:00:00"}
907
- assert(!JSON::Validator.validate(schema,data))
908
906
  data = {"a" => "2010-01-01T12:00:00z"}
909
907
  assert(!JSON::Validator.validate(schema,data))
910
908
  data = {"a" => "2010-01-0112:00:00Z"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: