grpc-rest 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '097d1a366f7eb41bd6a4b1e68f8cacfa84e74013aaed85d3348a8be300503f64'
4
- data.tar.gz: ef6e2ca8a7f43577a51d0fb9b85ad2ed6576f8591b33520732c6a62dd976daf2
3
+ metadata.gz: 5e28479dab1a6c6ed45aaf5a04c293a2e672b4c33e7b55a50df0863aaa8a0b4b
4
+ data.tar.gz: b813da5fc1c9e3629bbb06e4ca9a8d3b518c4219eff5d5b326eec7f0eac83e3b
5
5
  SHA512:
6
- metadata.gz: 6a181f74f58f23e2c89b73e24833197e365a167cdea63b55a31635d06349062becc15f9b1ead3572801514587be288fa5aca02f180b8c519a505350ea8e475f5
7
- data.tar.gz: fd0c20102f445578d5c21a5a984e95323fbdc9a5d102c8e9d8ccadd17a9b9196896e0a6e6c55ac3fd1c98f6e3b3b6b4669e4ec5573970d1dbf1c1663b9fab46d
6
+ metadata.gz: 92606239e1d5233e80844311cf26672e58548883af6801e474e3e5cd4c052a050234cd5624024be7f9e29c2b040d5983681c3c9897cb3a7158fd1290f8ed5328
7
+ data.tar.gz: 50d61f9784a195d55b5566eafc4bc59b25a6fca6bb4e37eb1197b3cb30408020fa91dbf8478a729bc122f262a4d720105a09796d26dedf6c944840de50281283
data/CHANGELOG CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## UNRELEASED
9
9
 
10
+ # 0.5.1 - 2025-08-27
11
+
12
+ - Fix: Better error message for invalid time values.
13
+
10
14
  # 0.5.0 - 2025-08-25
11
15
 
12
16
  - ***MAJOR CHANGE***: `grpc-rest` now no longer requires any code generation. All functionality is dynamic and loads on startup.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grpc-rest (0.5.0)
4
+ grpc-rest (0.5.1)
5
5
  google-protobuf (>= 4.30.2)
6
6
  grpc
7
7
  rails (>= 6.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrpcRest
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
5
5
  end
data/lib/grpc_rest.rb CHANGED
@@ -90,7 +90,12 @@ module GrpcRest
90
90
  when 'google.protobuf.Timestamp'
91
91
  return Google::Protobuf::Timestamp.from_time(Time.at(val)) if val.is_a?(Numeric)
92
92
 
93
- Google::Protobuf::Timestamp.from_time(Time.new(val))
93
+ begin
94
+ parsed_time = Time.new(val)
95
+ Google::Protobuf::Timestamp.from_time(parsed_time)
96
+ rescue ArgumentError => e
97
+ raise ArgumentError, "Could not parse time value '#{val}': #{e.message}"
98
+ end
94
99
 
95
100
  when 'google.protobuf.Value'
96
101
  Google::Protobuf::Value.from_ruby(val)
@@ -51,6 +51,22 @@ RSpec.describe 'generated controller', type: :request do
51
51
  'fullResponse' => %({"testId":"abc","foobar":"xyz","secondRecord":{"subId":"id1","anotherId":"id2"},"timestampField":"2024-04-03T01:02:03Z"})
52
52
  })
53
53
  end
54
+
55
+ it 'should return a good error for invalid times' do
56
+ params = {
57
+ sub_id: 'id1',
58
+ another_id: 'id2'
59
+ }
60
+
61
+ post '/test2?test_id=abc&foobar=xyz&timestamp_field=2024-04-03+01:02', params: params, as: :json
62
+ puts response.body
63
+ expect(response).not_to be_successful
64
+ expect(response.parsed_body).
65
+ to match(hash_including({
66
+ 'code' => 3,
67
+ 'message' => "InvalidArgument: Could not parse time value '2024-04-03 01:02': missing sec part: 01:02"
68
+ }))
69
+ end
54
70
  end
55
71
 
56
72
  describe 'using sub-record splat' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner