json_schema_tools 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 +8 -8
- data/lib/schema_tools/modules/hash.rb +3 -3
- data/lib/schema_tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjMyMjgzZTgyMzQ3OTBlOGVlNDEzNTI0OTMwYWQxNGFkYTViNzMwMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTE5ODAyMTI0YThkYzc1ZDFhYjFiMDA2ODVhZDJjZDI2MjRkMDAwNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2YwOWZhMWEyMmZlZDdjZjlmMDA5NDhkMDNiM2RmZTJhYWIwNjM2ZDM4NGQy
|
10
|
+
OGE4ZGNhNjg2OGUwY2FkOWFkNmRhMWRkNzAyN2JkY2VmMmJhODliNTMxZWUz
|
11
|
+
ZWI0MWRmYTQ1ZTEzYWM5NzRmMGY0OWRjZTJhZTVhMzUyMzgxOWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjRiYWQ5MTJkNmU2OGM3NGI0ODlkYzFjMzAzMjgyMzFmNzYzNmJjYjkwNjU1
|
14
|
+
NzM1ODM4NjNlZGE5Yjg2ZDNmNzIyNGZjOTkwMjE5NzQzMTBlN2IyZTI5YTA3
|
15
|
+
MThmODY2ZThiYjA4YzAxZDM4Mzk4NjJlY2ViMjdjM2EyZTY4YmQ=
|
@@ -41,11 +41,9 @@ module SchemaTools
|
|
41
41
|
# { 'invoice' => {'title'=>'hello world', 'number'=>'4711' } }
|
42
42
|
#
|
43
43
|
def from_schema(obj, opts={})
|
44
|
-
|
45
44
|
# get objects class name without inheritance
|
46
45
|
real_class_name = obj.class.name.split('::').last.underscore
|
47
46
|
class_name = opts[:class_name] || real_class_name
|
48
|
-
|
49
47
|
# get schema
|
50
48
|
inline_schema = opts.delete(:schema) if opts[:schema].present?
|
51
49
|
schema = inline_schema || SchemaTools::Reader.read(class_name, opts[:path])
|
@@ -65,7 +63,9 @@ module SchemaTools
|
|
65
63
|
# @param [Hash] schema
|
66
64
|
# @param [Hash] opts
|
67
65
|
def parse_properties(obj, schema, opts)
|
68
|
-
fields
|
66
|
+
# only allow fields for first level object.
|
67
|
+
# TODO collect . dot separated field names and pass them on to the recursive calls e.g nested object, ary
|
68
|
+
fields = opts.delete(:fields)
|
69
69
|
data = {}
|
70
70
|
schema['properties'].each do |field, prop|
|
71
71
|
next if fields && !fields.include?(field)
|
data/lib/schema_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_schema_tools
|
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
|
- Georg Leciejewski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|