apimatic_core 0.3.5 → 0.3.6

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: 748bf7df87d6f81d0b5d593d893451ea2f1a38d4baa0f5a8034d12a9287bf11f
4
- data.tar.gz: 5fbf6484cb560e4c0fbd9cf41b18dfdb65c1efb52a66de4d559916ca417d3eca
3
+ metadata.gz: 98a7a24dd99dffe816667bdbd683775d7b4961a2159cdcca5f6d01202aaad8cb
4
+ data.tar.gz: e869b19703d585e264d2786da045a2689f14cd5a905b1124bbd4f37df097ec63
5
5
  SHA512:
6
- metadata.gz: 3bfbdc11191f658ac7e3dc9dd5dcc57b6854bcd3690ebeba1a6c77122a543c92f39e486aae6106bd191bf25bed3c599d073be0e49844445b40d61a45f29840ba
7
- data.tar.gz: 4bf096df545db3b501d85c7a22e945dff7c4f2ef287c88af9b7a782293435a8063373209acddcfd309fc3ba6330b535cb6d4b14509dfcfc0f25802c82205fc7a
6
+ metadata.gz: e49802888b0b9e38e94f8e287ba5b4fdfd049145643ec2f39076f5b2d4a5d8ebb6d54599aa89f016597ca9ad2f7d6d4f2a60f4a10654d654ee0a7429a809866f
7
+ data.tar.gz: 95cff96de07545fe02287eff869b34b43e424ca094ccde6ecf9ef892c0f0b019c1b5b9fd9959962ceaef10a9b541329288a3db881421b35d6f8057c6d4a383dc
@@ -261,13 +261,21 @@ module CoreLibrary
261
261
  # Checks if a value or all values in a nested structure satisfy a given type condition.
262
262
  # @param [Object] value The value or nested structure to be checked.
263
263
  # @param [Proc] type_callable A callable object that defines the type condition.
264
+ # @param [Boolean] is_model_hash A flag to identify the provided value is a model value hash.
265
+ # @param [Boolean] is_inner_model_hash A flag to identify the provided value is a hash of model value hash.
264
266
  # @return [Boolean] Returns true if the value or all values in the
265
267
  # structure satisfy the type condition, false otherwise.
266
- def self.valid_type?(value, type_callable)
268
+ def self.valid_type?(value, type_callable, is_model_hash: false, is_inner_model_hash: false)
267
269
  if value.is_a?(Array)
268
- value.all? { |item| valid_type?(item, type_callable) }
269
- elsif value.is_a?(Hash)
270
- value.values.all? { |item| valid_type?(item, type_callable) }
270
+ value.all? do |item|
271
+ valid_type?(item, type_callable,
272
+ is_model_hash: is_model_hash,
273
+ is_inner_model_hash: is_inner_model_hash)
274
+ end
275
+ elsif value.is_a?(Hash) && (!is_model_hash || is_inner_model_hash)
276
+ value.values.all? do |item|
277
+ valid_type?(item, type_callable, is_model_hash: is_model_hash)
278
+ end
271
279
  else
272
280
  !value.nil? && type_callable.call(value)
273
281
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apimatic_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-15 00:00:00.000000000 Z
11
+ date: 2024-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces