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 +4 -4
- data/CHANGELOG +4 -0
- data/Gemfile.lock +1 -1
- data/lib/grpc_rest/version.rb +1 -1
- data/lib/grpc_rest.rb +6 -1
- data/spec/grpc_rest_spec.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e28479dab1a6c6ed45aaf5a04c293a2e672b4c33e7b55a50df0863aaa8a0b4b
|
4
|
+
data.tar.gz: b813da5fc1c9e3629bbb06e4ca9a8d3b518c4219eff5d5b326eec7f0eac83e3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/grpc_rest/version.rb
CHANGED
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
|
-
|
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)
|
data/spec/grpc_rest_spec.rb
CHANGED
@@ -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×tamp_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
|