apipie-rails 0.5.9 → 0.5.10

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
  SHA1:
3
- metadata.gz: 67882facd3165a11bb36de196c2eaefd4444f698
4
- data.tar.gz: 26ad0df6cd1f15d9f530838cf8dd9c7298dab91a
3
+ metadata.gz: 6bcdf76f920b92251c36c8c5d1ca0b3faf7094b1
4
+ data.tar.gz: afaa0c9b44801726cd6f20dfedf787c18098bb95
5
5
  SHA512:
6
- metadata.gz: b3b202e8d5774e1f669b93059df6152a7006177e04cb1ca3cde7151207aa3318310f75a374f67fa38752f3c7f53c18c3a72d0db165655460da97ec362465382f
7
- data.tar.gz: f7541b0e319499e074b7171dd286b33f73a7b398e8e04a41bd5242b824f08f8bc83adabdadb75605e8143a40800729369f170da9e2d384f8acebea23f1aea9a1
6
+ metadata.gz: fcc628dd565f89b38772f807c3ed5b08be2c372710fca2bb630d5a04be492277c9be5cc5fecaa7bb5ac59a7e808e3e5154ac8b7236e26d5c3ed536bab5e2907f
7
+ data.tar.gz: 581b097b15f2ba84e13cd1124899f10dafcbf10999ad4097ddefb27cd0dedb50d05c5bd3a910fbf52083a008dcc3ed08b0f2a53e9f1cfd2cdfb31f2e51e6aac9
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  ===========
3
3
 
4
+ v0.5.10
5
+ ------
6
+
7
+ - Support response validation [\#626](https://github.com/Apipie/apipie-rails/pull/626) ([COzero](https://github.com/COzero))
8
+
4
9
  v0.5.9
5
10
  ------
6
11
 
@@ -225,7 +225,13 @@ module Apipie
225
225
 
226
226
  def has_valid_type?(value)
227
227
  if @items_type
228
- value.kind_of?(@items_type)
228
+ item_validator = BaseValidator.find('', @items_type, nil, nil)
229
+
230
+ if item_validator
231
+ item_validator.valid?(value)
232
+ else
233
+ value.kind_of?(@items_type)
234
+ end
229
235
  else
230
236
  true
231
237
  end
@@ -1,3 +1,3 @@
1
1
  module Apipie
2
- VERSION = '0.5.9'
2
+ VERSION = '0.5.10'
3
3
  end
@@ -24,18 +24,38 @@ module Apipie::Validator
24
24
  end
25
25
 
26
26
  context "with a constraint on items type" do
27
- let(:validator) { ArrayValidator.new(param_desc, Array, :of => String) }
27
+ let(:validator) { ArrayValidator.new(param_desc, Array, :of => type) }
28
28
 
29
- it "accepts array of specified type" do
30
- expect(validator.validate(['string1', 'string2'])).to eq(true)
31
- end
29
+ context "String" do
30
+ let(:type) { String }
32
31
 
33
- it "accepts empty array" do
34
- expect(validator.validate([])).to eq(true)
32
+ it "accepts array of specified type" do
33
+ expect(validator.validate(['string1', 'string2'])).to eq(true)
34
+ end
35
+
36
+ it "accepts empty array" do
37
+ expect(validator.validate([])).to eq(true)
38
+ end
39
+
40
+ it "does not accepts array with other types" do
41
+ expect(validator.validate(['string1', true])).to eq(false)
42
+ end
35
43
  end
36
44
 
37
- it "does not accepts array with other types" do
38
- expect(validator.validate(['string1', true])).to eq(false)
45
+ context ":number" do
46
+ let(:type) { :decimal }
47
+
48
+ it "accepts array of specified type" do
49
+ expect(validator.validate([12, '14'])).to eq(true)
50
+ end
51
+
52
+ it "accepts empty array" do
53
+ expect(validator.validate([])).to eq(true)
54
+ end
55
+
56
+ it "does not accepts array with other types" do
57
+ expect(validator.validate([12, 'potato'])).to eq(false)
58
+ end
39
59
  end
40
60
  end
41
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pokorny
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-06-29 00:00:00.000000000 Z
12
+ date: 2018-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails