json_skooma 0.2.3 → 0.2.4

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: b477f1320adcfae0e544129fd0c7cf7423221582a4914df84e2b685bbc3d3407
4
- data.tar.gz: 33be1f69264fa10de07b4391850945343996832b3f0b534fbc4ea34f125dee28
3
+ metadata.gz: 590937fba1ba290810ef51644d7f56126aee04b76ab7ded47b3f8175ccaa2eb5
4
+ data.tar.gz: 4c9c91d0ea350ad63dbec27730cbb66841e8aa54886d74ad492d7445dde3bd45
5
5
  SHA512:
6
- metadata.gz: 4fd6ad6cf954c7b5cd9886691280e334b49332a51b74beba483a2041e00c36ce0b9662a52cdc1ba8ee310fc979117ee3a08f8df05f1f6291c5e501215149dd2a
7
- data.tar.gz: 5d428bce4e4e1979cf908d4efc9cdf397d60449fde95742df5df7d18084ced68cacc9169d6e4ee1517a152bb990ebce9a38f48221968cfa1633dc14503b3b31a
6
+ metadata.gz: fb845c9b702a338437a195ac5511b1a9abb18177a7ec7be314571f6a2c2f089495bc1449d9afd293babab77ef333c963dc1f8a49d4568f674a59e4bd8606bf23
7
+ data.tar.gz: 4f100d96e00e5e01cfdffe7d38192c19446f1ea901858139903a75598b1413ea5c0887b170fec16b52b1950139a1f006af0a527ec6aef6a96c91ec0b660aeddb
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.4] - 2024-10-31
11
+
12
+ ### Added
13
+
14
+ - Improve error messages for missing required keys ([@alexkalderimis])
15
+
10
16
  ## [0.2.3] - 2024-04-28
11
17
 
12
18
  ### Fixed
@@ -47,10 +53,12 @@ and this project adheres to [Semantic Versioning].
47
53
 
48
54
  - Initial implementation. ([@skryukov])
49
55
 
50
- [@skryukov]: https://github.com/skryukov
56
+ [@alexkalderimis]: https://github.com/alexkalderimis
51
57
  [@killondark]: https://github.com/killondark
58
+ [@skryukov]: https://github.com/skryukov
52
59
 
53
- [Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.3...HEAD
60
+ [Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.2.4...HEAD
61
+ [0.2.4]: https://github.com/skryukov/json_skooma/compare/v0.2.3...v0.2.4
54
62
  [0.2.3]: https://github.com/skryukov/json_skooma/compare/v0.2.2...v0.2.3
55
63
  [0.2.2]: https://github.com/skryukov/json_skooma/compare/v0.2.1...v0.2.2
56
64
  [0.2.1]: https://github.com/skryukov/json_skooma/compare/v0.2.0...v0.2.1
@@ -8,9 +8,20 @@ module JSONSkooma
8
8
  self.instance_types = "object"
9
9
 
10
10
  def evaluate(instance, result)
11
- return if json.value.all? { |val| instance.key?(val) }
11
+ missing = required_keys.reject { |key| instance.key?(key) }
12
+ return if missing.none?
12
13
 
13
- result.failure("The object is missing required properties #{json.value.join(", ")}")
14
+ result.failure(missing_keys_message(missing))
15
+ end
16
+
17
+ private
18
+
19
+ def required_keys
20
+ json.value
21
+ end
22
+
23
+ def missing_keys_message(missing)
24
+ "The object requires the following keys: #{required_keys.join(", ")}. Missing keys: #{missing.join(", ")}"
14
25
  end
15
26
  end
16
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONSkooma
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_skooma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-28 00:00:00.000000000 Z
11
+ date: 2024-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  - !ruby/object:Gem::Version
238
238
  version: '0'
239
239
  requirements: []
240
- rubygems_version: 3.5.7
240
+ rubygems_version: 3.5.17
241
241
  signing_key:
242
242
  specification_version: 4
243
243
  summary: I bring some sugar for your JSONs.