twirp 1.6.0 → 1.7.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: 8558dba268ebf307651176d197204d1b803ec9429666e18f9831e597bdbb22f7
4
- data.tar.gz: 8d2cde0d2dbaafa71ea9b2890ca459f010781f3b56c60976b2a41b5fbb69f931
3
+ metadata.gz: d0046cb23f769232f34b2ec9b85961ee1311e59d68458b08539a0bb4f5789e83
4
+ data.tar.gz: dae8b79d9d9b05f95916f7676a228732f1ca3f3779174fde51a2a2f0e7b09f87
5
5
  SHA512:
6
- metadata.gz: e64ccaf9a5f9005ff31c97fff51229b542492b9b6951b882836345828864173cc0f1b6f3b6831ef79f064e807438ed358f21a9cc1cc26d0c5516f095a69d91a0
7
- data.tar.gz: 971687bef1e682359ac6a9bbfec2fdf1d4a4b44bd9a39b1732230de7aa592c4f12fc0d32001cd79cb874963f133dff832c3ebff8bf5bf32a5e0fa6d1b05e71c2
6
+ metadata.gz: db7e199e1a1593e4f6493fa8675018740d8d946f418ef02964c64d6a94b3410aa7ec1e79f5655fea89741cf65acbd0bce7003bdc844d9640d577b9a81ac27c24
7
+ data.tar.gz: db7a5ce35a8ca7b0b532594b0535c350f96667c4530830be14dfdb4016f142c21ff3939375183f7836d752ba3c31af70a910785829820b0ff7d1127f0b683c9a
@@ -23,7 +23,7 @@ module Twirp
23
23
 
24
24
  def decode(bytes, msg_class, content_type)
25
25
  case content_type
26
- when JSON then msg_class.decode_json(bytes)
26
+ when JSON then msg_class.decode_json(bytes, ignore_unknown_fields: true)
27
27
  when PROTO then msg_class.decode(bytes)
28
28
  else raise ArgumentError.new("Invalid content_type")
29
29
  end
@@ -12,5 +12,5 @@
12
12
  # permissions and limitations under the License.
13
13
 
14
14
  module Twirp
15
- VERSION = "1.6.0"
15
+ VERSION = "1.7.0"
16
16
  end
@@ -179,6 +179,15 @@ class ServiceTest < Minitest::Test
179
179
  }, JSON.parse(body[0]))
180
180
  end
181
181
 
182
+ def test_json_request_ignores_unknown_fields
183
+ rack_env = json_req "/example.Haberdasher/MakeHat", inches: 10, fake: 3
184
+ status, headers, body = haberdasher_service.call(rack_env)
185
+
186
+ assert_equal 200, status
187
+ assert_equal 'application/json', headers['Content-Type']
188
+ assert_equal({"inches" => 10, "color" => "white"}, JSON.parse(body[0]))
189
+ end
190
+
182
191
  def test_bad_route_triggers_on_error_hooks
183
192
  svc = haberdasher_service
184
193
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.required_ruby_version = '>= 1.9'
22
- spec.add_runtime_dependency 'google-protobuf', '~> 3.0', '>= 3.0.0'
22
+ spec.add_runtime_dependency 'google-protobuf', '~> 3.0', '>= 3.7.0'
23
23
  spec.add_runtime_dependency 'faraday', '< 2' # for clients
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twirp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyrus A. Forbes
@@ -9,28 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-30 00:00:00.000000000 Z
12
+ date: 2020-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-protobuf
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 3.0.0
21
18
  - - "~>"
22
19
  - !ruby/object:Gem::Version
23
20
  version: '3.0'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 3.7.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: 3.0.0
31
28
  - - "~>"
32
29
  - !ruby/object:Gem::Version
33
30
  version: '3.0'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.7.0
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: faraday
36
36
  requirement: !ruby/object:Gem::Requirement