blumquist 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/blumquist.rb +25 -9
- data/lib/blumquist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 389e1b2f8a0295f3c975f7b3877da1877c32d150
|
4
|
+
data.tar.gz: d144ddd0daf59b3ce2719bfe60b7787d0b263417
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0d8b821d05fe847fc2670a86498849fb50f3b0ccfffb9c220c97876ca6d846eac7aadc93ac0692b7e1055d428552f8c4679bea7a57551b070ebb76371b6544
|
7
|
+
data.tar.gz: 335da3462e4abb87f212a5c63c83ab6fc6ae3196faeaec8293612a78f824bd98171b663e7e63562fd02fa804baf8502f49883b6d28f7b2785a814eb4150f3822
|
data/CHANGELOG.md
CHANGED
data/lib/blumquist.rb
CHANGED
@@ -102,15 +102,31 @@ class Blumquist
|
|
102
102
|
# "type": "array",
|
103
103
|
# "items": [{ "$ref": "#/definitions/mytype" }]
|
104
104
|
#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
105
|
+
# or through
|
106
|
+
#
|
107
|
+
# "type": "array",
|
108
|
+
# "items": [{ "type": "number" }]
|
109
|
+
#
|
110
|
+
type_def = [@schema[:properties][property][:items]].flatten.first
|
111
|
+
|
112
|
+
# The items of this array are defined by a pointer
|
113
|
+
if type_def[:$ref]
|
114
|
+
item_schema = resolve_json_pointer!(type_def)
|
115
|
+
raise(Errors::MissingArrayItemsType, @schema[:properties][property]) unless item_schema
|
116
|
+
|
117
|
+
sub_schema = item_schema.merge(
|
118
|
+
definitions: @schema[:definitions]
|
119
|
+
)
|
120
|
+
|
121
|
+
@data[property] ||= []
|
122
|
+
@data[property] = @data[property].map do |item|
|
123
|
+
Blumquist.new(schema: sub_schema, data: item, validate: @validate)
|
124
|
+
end
|
125
|
+
elsif primitive_type?(type_def[:type])
|
126
|
+
|
127
|
+
# We don't know what to do, so let's panic
|
128
|
+
else
|
129
|
+
raise(Errors::UnsupportedType, type_def[:type])
|
114
130
|
end
|
115
131
|
end
|
116
132
|
end
|
data/lib/blumquist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blumquist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jannis Hermanns
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|