request_handler 0.15.0 → 1.0.0

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: 3ec28a9872f4f531acc1942ec45f37aecb057f2857cf50aa26dede690625c13f
4
- data.tar.gz: b2c4c2c0131ab55a364265ded644e0151d338e2a2f505d8dd68e9ea35f16a753
3
+ metadata.gz: 65eef6ec09f3ee1701b3d47ac807e34ae25bcf1da1390f4115264edfe0596826
4
+ data.tar.gz: b3be4acbdf53d5a1625c75858e0aee50a2e9b99bc5b4f1208cd79d891473c7fe
5
5
  SHA512:
6
- metadata.gz: 7fe42bb5f624fa531353554ce192e6577299eabec6d66ef465adb6efc995869568173b075c40498fca292d9e248776dd8a3b4bfdc8939e741f9e2a3d1af96160
7
- data.tar.gz: 0a87c3d8751372650e5ef31f9fd5bdd1421f0472e623f28f1316e8255c88d4e6b06aef2732b54deb7f3f3ce7ca254fffca979a445f265becaf03913710e151c1
6
+ metadata.gz: cc8b73661dcdd394026e6ee34bd270adef9b7130a29c5a86a62962ada7bb36c618625411ad2ecd006d34a5933e1416831ad54672b51c0ede3ffe15bf61941466
7
+ data.tar.gz: 0c8b9cb186c4c4fe90ba58baf401d9b4c739785001214bc14cea683ba1618f9b6fbfb14ff9933908918f1cea1a35d3803e65e76827ddb6de7ab82267e290411a
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.0] - 2018-07-03
10
+ ### Added
11
+ - possibility to send NULL values in relationships
12
+
13
+ ### Fixed
14
+ - fix nested schemas with symbolized keys
15
+
9
16
  ## [0.15.0] - 2018-06-20
10
17
  ### Added
11
18
  - JsonParser for non-jsonapi documents in body an multipart files
@@ -91,7 +98,8 @@ sort_params returns an array of dtos now `DataTransferObject.new(field: "test",
91
98
 
92
99
  version bump for publishing
93
100
 
94
- [Unreleased]: https://github.com/runtastic/request_handler/compare/v0.15.0...HEAD
101
+ [Unreleased]: https://github.com/runtastic/request_handler/compare/v1.0.0...HEAD
102
+ [1.0.0]: https://github.com/runtastic/request_handler/compare/v0.15.0...v1.0.0
95
103
  [0.15.0]: https://github.com/runtastic/request_handler/compare/v0.14.0...v0.15.0
96
104
  [0.14.0]: https://github.com/runtastic/request_handler/compare/v0.13.0...v0.14.0
97
105
  [0.13.0]: https://github.com/runtastic/request_handler/compare/v0.12.0...v0.13.0
@@ -33,7 +33,6 @@ module RequestHandler
33
33
  def flatten_relationship_resource_linkages(relationships)
34
34
  relationships.each_with_object({}) do |(k, v), memo|
35
35
  resource_linkage = v['data']
36
- next if resource_linkage.nil?
37
36
  memo[k] = resource_linkage
38
37
  end
39
38
  end
@@ -17,6 +17,7 @@ module RequestHandler
17
17
 
18
18
  def validate_schema(data, with: schema)
19
19
  raise MissingArgumentError, data: 'is missing' if data.nil?
20
+ data = deep_symbolize_keys(data) if with.rules.keys.first.is_a?(Symbol)
20
21
  validator = validate(data, schema: with)
21
22
  validation_failure?(validator)
22
23
  validator.output
@@ -47,6 +48,19 @@ module RequestHandler
47
48
  memo
48
49
  end
49
50
 
51
+ def deep_symbolize_keys(hash)
52
+ mem = {}
53
+ hash.map do |key, value|
54
+ if value.is_a?(Hash)
55
+ value = deep_symbolize_keys(value)
56
+ elsif value.is_a?(Array)
57
+ value.map! { |v| v.is_a?(Hash) ? deep_symbolize_keys(v) : v }
58
+ end
59
+ mem[key.to_sym] = value
60
+ end
61
+ mem
62
+ end
63
+
50
64
  attr_reader :schema, :schema_options
51
65
  end
52
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RequestHandler
4
- VERSION = '0.15.0'.freeze
4
+ VERSION = '1.0.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Eger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-06-20 00:00:00.000000000 Z
12
+ date: 2018-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-validation