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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmU2MzJlYzY5MGM2NGIxMDkyNWIwY2NiZWFiNGVkODY2NjdhNzkxYg==
4
+ ZjMyMjgzZTgyMzQ3OTBlOGVlNDEzNTI0OTMwYWQxNGFkYTViNzMwMA==
5
5
  data.tar.gz: !binary |-
6
- NzY3NGYyOGY4MTU1ODQwMmYyMjhlZDRkZjQxNDA0Y2M2ZWI2ZDVhNg==
6
+ YTE5ODAyMTI0YThkYzc1ZDFhYjFiMDA2ODVhZDJjZDI2MjRkMDAwNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjZmMWZhODZmM2FlNDgyODQ0NmU4NmI1OGQzZTNjNDk5ZDRmNmEzYTU4MjY0
10
- NWYzNmE1NTg0YzgzZTViOWFhNjc1NjcwMWQ1NTkyZDQ1NmRkZjRkYTgxOTg5
11
- NTAwNzc0YzkxNmQwZjY2YzU0MDg0MGJkMmFjYWY2NWViNWE2OGU=
9
+ Y2YwOWZhMWEyMmZlZDdjZjlmMDA5NDhkMDNiM2RmZTJhYWIwNjM2ZDM4NGQy
10
+ OGE4ZGNhNjg2OGUwY2FkOWFkNmRhMWRkNzAyN2JkY2VmMmJhODliNTMxZWUz
11
+ ZWI0MWRmYTQ1ZTEzYWM5NzRmMGY0OWRjZTJhZTVhMzUyMzgxOWY=
12
12
  data.tar.gz: !binary |-
13
- NjRiZDRlNTRiNTI4MDNhZmJlZmE4MDU3ZjA4Y2ZjMmQ3MjIyMDVhMTlhZDFk
14
- YWRjNDkzZDg0Njc1ZDdhMGE2NWI5YzQ0YWNkMWM3NjRjMjkzYjdkYWM2ZjFj
15
- ODIxYWIxYTVlY2RiYzYyYmJlMWVlM2E3ZWI5NDJkYTY3NDYzZDI=
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 = opts[: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)
@@ -1,3 +1,3 @@
1
1
  module SchemaTools
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
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.1
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-09 00:00:00.000000000 Z
11
+ date: 2014-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json