simple_json_schema 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bfd995209a8432bc92730f10961b61d8d9e0d1e3cd1aaf06432d76654dd7d66
4
- data.tar.gz: 043f347f1c497be224fcefdd153b23bb16024410d8d8865555c6dd752d28a2f2
3
+ metadata.gz: ba091bad31957536ee21fd439a1841fd62bfe9de3183fb5cfdf5e77cfb78d750
4
+ data.tar.gz: 3b3d9cae644a8d60c00ebc4329168e7de3f69eae71ebf1523cfe11a0edcea7fc
5
5
  SHA512:
6
- metadata.gz: 016b1db271f0eada2ef8dd65ccc2eaf89294685231fe6645578b8959e20011a6418e9176333c6b1ff9f9f455d309cc232177a7b1958f7e9f84fc88994b668b77
7
- data.tar.gz: 3c8e6f11c651ccd1537eaf5ecfb010125f837568bce1d9b07bfebd431ad5eb09c7760e8f43b1ffb62c24977276e3b9959372b2152c012a23e19f17aa81c766a2
6
+ metadata.gz: fca0fe9bd46eb26ed08ec4bb1be70abf8514b455f783799405a472d09b789555bc823f4329f75daa6dc96365161ed9158a2c386f66be1d17ea9cf6fa4813c31a
7
+ data.tar.gz: e626dd58a40c94ef679e93f36951d66dfb1d18f0c3a5308240cde33ba6cbe06c4e20fde2649f0cb27dd15732652c02ff52cdb7effdf24f9e38e1f84ca493d324
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_json_schema (0.1.4)
4
+ simple_json_schema (0.1.5)
5
5
  activesupport (~> 6.0)
6
6
  addressable (~> 2.7)
7
7
  ecma-re-validator (~> 0.3)
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![coverage report](https://gitlab.com/vliper/simple_json_schema/badges/master/coverage.svg)](https://gitlab.com/vliper/simple_json_schema/-/commits/master)
5
5
  [![Gem Version](https://badge.fury.io/rb/simple_json_schema.svg)](https://badge.fury.io/rb/simple_json_schema)
6
6
 
7
- This implementation of the JSON Schema validation is based on the [JSONSchemer](https://github.com/davishmcclurg/json_schemer) (WHIT IS THE RECOMMENDED TO BE USED!), but only implement the Draft7, whit [limitations](https://gitlab.com/vliper/simple_json_schema/-/blob/master/spec/simple_json_schema/json_schema_test_suite_spec.rb#L26) and some feature embedded.
7
+ This implementation of the JSON Schema validation is based on the [JSONSchemer](https://github.com/davishmcclurg/json_schemer) **(WHIT IS THE RECOMMENDED TO BE USED!)**, but only implement the Draft7, whit [limitations](https://gitlab.com/vliper/simple_json_schema/-/blob/master/spec/simple_json_schema/json_schema_test_suite_spec.rb#L26) and some feature embedded.
8
8
 
9
9
  # Installation
10
10
 
@@ -72,6 +72,7 @@ Whit options is possible to improve the behavior.
72
72
  Some extra implementations on types (THIS IS NOT ON THE DRAFT7 DEFINITION!)
73
73
 
74
74
  | Type | Attribute | Description | Allowed values |
75
+ | ---- | --------- | ----------- | -------------- |
75
76
  | string | required | Will evaluate the `blank?` concept on the string | true/false |
76
77
  | integer | required | Will enforce value != 0 | true/false |
77
78
  | number | required | Will enforce value != 0.0 | true/false |
@@ -9,6 +9,7 @@ module SimpleJSONSchema
9
9
  value = scope.value
10
10
 
11
11
  return scope.error(:integer) if !value.is_a?(::Numeric) || (!value.is_a?(::Integer) && value.floor != value)
12
+ return scope.error(:zero_not_allowed) if scope[:required] == true && value.zero?
12
13
 
13
14
  super
14
15
  end
@@ -9,6 +9,7 @@ module SimpleJSONSchema
9
9
  value = scope.value
10
10
 
11
11
  return scope.error(:number) unless value.is_a?(::Numeric)
12
+ return scope.error(:zero_not_allowed) if scope[:required] == true && value.zero?
12
13
 
13
14
  super
14
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleJSONSchema
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_json_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georgeo Rocco