deimos-ruby 1.12.6 → 1.13.0
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.md +5 -0
- data/lib/deimos/schema_backends/avro_schema_registry.rb +2 -1
- data/lib/deimos/version.rb +1 -1
- data/lib/generators/deimos/schema_class_generator.rb +2 -0
- data/spec/generators/schema_class/my_schema_with_complex_types_spec.rb +3 -2
- data/spec/schema_classes/my_schema_with_complex_types.rb +34 -2
- data/spec/schemas/com/my-namespace/MySchemaWithComplexTypes.avsc +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c57c2700b01b998f358cb4e96ee6e6b2c1c8c32936d741b2371182a6017f7adc
|
4
|
+
data.tar.gz: 440bf25b629ba34da51cd1c0a1b443858bcd4ca270fed800b6e277c050b0741f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05df77f7f8890959ea91817a7497c11348d3b68f349462275a1ffb133a1c8194d9ee2282ac3dbe14a389bd09f16f059c88b467c05fb959c1a334b7c3789ade92
|
7
|
+
data.tar.gz: bc8b8c832a7399a6c60a4a0ac71582aff4ff324d5a2c9bb2a73241bb64de3a958d09208e1c127d36e8b3c47077857224ec853aaea769ef00aaef88dc6e6cf0e9
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
# 1.13.0 - 2022-03-30
|
11
|
+
|
12
|
+
- Pass the Deimos logger to `AvroTurf::Messaging` for consistent logging
|
13
|
+
- Fix an issue with nullable enums not being included in the auto-generated schema class
|
14
|
+
|
10
15
|
# 1.12.6 - 2022-03-14
|
11
16
|
|
12
17
|
- Fix NameError when using Datadog Metrics
|
data/lib/deimos/version.rb
CHANGED
@@ -57,7 +57,7 @@ RSpec.describe Schemas::MySchemaWithComplexTypes do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
let(:schema_fields) do
|
60
|
-
%w(test_id test_float test_int_array test_optional_int test_string_array some_integer_map some_record some_optional_record some_record_array some_record_map some_enum_array)
|
60
|
+
%w(test_id test_float test_int_array test_optional_int test_string_array some_integer_map some_record some_optional_record some_record_array some_record_map some_enum_array some_optional_enum)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should return the name of the schema and namespace' do
|
@@ -77,6 +77,7 @@ RSpec.describe Schemas::MySchemaWithComplexTypes do
|
|
77
77
|
'test_float' => 1.2,
|
78
78
|
'test_string_array' => %w(abc def),
|
79
79
|
'test_int_array' => [123, 456],
|
80
|
+
'some_optional_enum' => nil,
|
80
81
|
'test_optional_int' => 123,
|
81
82
|
'some_integer_map' => { 'int_1' => 1, 'int_2' => 2 },
|
82
83
|
'some_record' => { 'a_record_field' => 'field 1' },
|
@@ -96,7 +97,7 @@ RSpec.describe Schemas::MySchemaWithComplexTypes do
|
|
96
97
|
end
|
97
98
|
|
98
99
|
it 'should return a JSON string of the payload' do
|
99
|
-
s = '{"test_id":"test id","test_float":1.2,"test_string_array":["abc","def"],"test_int_array":[123,456],"test_optional_int":123,"some_integer_map":{"int_1":1,"int_2":2},"some_record":{"a_record_field":"field 1"},"some_optional_record":{"a_record_field":"field 2"},"some_record_array":[{"a_record_field":"field 3"},{"a_record_field":"field 4"}],"some_record_map":{"record_1":{"a_record_field":"field 5"},"record_2":{"a_record_field":"field 6"}},"some_enum_array":["sym1","sym2"]}'
|
100
|
+
s = '{"test_id":"test id","test_float":1.2,"test_string_array":["abc","def"],"test_int_array":[123,456],"test_optional_int":123,"some_integer_map":{"int_1":1,"int_2":2},"some_record":{"a_record_field":"field 1"},"some_optional_record":{"a_record_field":"field 2"},"some_record_array":[{"a_record_field":"field 3"},{"a_record_field":"field 4"}],"some_record_map":{"record_1":{"a_record_field":"field 5"},"record_2":{"a_record_field":"field 6"}},"some_enum_array":["sym1","sym2"],"some_optional_enum":null}'
|
100
101
|
expect(klass.to_json).to eq(s)
|
101
102
|
end
|
102
103
|
end
|
@@ -55,6 +55,28 @@ module Schemas
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
# Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
|
59
|
+
class AnotherEnum < Deimos::SchemaClass::Enum
|
60
|
+
# @return ['sym3', 'sym4']
|
61
|
+
attr_accessor :another_enum
|
62
|
+
|
63
|
+
# :nodoc:
|
64
|
+
def initialize(another_enum)
|
65
|
+
super
|
66
|
+
self.another_enum = another_enum
|
67
|
+
end
|
68
|
+
|
69
|
+
# @override
|
70
|
+
def symbols
|
71
|
+
%w(sym3 sym4)
|
72
|
+
end
|
73
|
+
|
74
|
+
# @override
|
75
|
+
def to_h
|
76
|
+
@another_enum
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
58
80
|
### Primary Schema Class ###
|
59
81
|
# Autogenerated Schema for Record at com.my-namespace.MySchemaWithComplexTypes
|
60
82
|
class MySchemaWithComplexTypes < Deimos::SchemaClass::Record
|
@@ -69,6 +91,8 @@ module Schemas
|
|
69
91
|
attr_reader :some_record_map
|
70
92
|
# @return [Array<AnEnum>]
|
71
93
|
attr_reader :some_enum_array
|
94
|
+
# @return [nil, AnotherEnum]
|
95
|
+
attr_reader :some_optional_enum
|
72
96
|
|
73
97
|
### Attribute Accessors ###
|
74
98
|
# @param value [String]
|
@@ -116,6 +140,11 @@ module Schemas
|
|
116
140
|
end
|
117
141
|
end
|
118
142
|
|
143
|
+
# @param value [nil, AnotherEnum]
|
144
|
+
def some_optional_enum=(value)
|
145
|
+
@some_optional_enum = AnotherEnum.initialize_from_value(value)
|
146
|
+
end
|
147
|
+
|
119
148
|
# @override
|
120
149
|
def initialize(test_id: nil,
|
121
150
|
test_float: nil,
|
@@ -127,7 +156,8 @@ module Schemas
|
|
127
156
|
some_optional_record: nil,
|
128
157
|
some_record_array: nil,
|
129
158
|
some_record_map: nil,
|
130
|
-
some_enum_array: nil
|
159
|
+
some_enum_array: nil,
|
160
|
+
some_optional_enum: nil)
|
131
161
|
super
|
132
162
|
self.test_id = test_id
|
133
163
|
self.test_float = test_float
|
@@ -140,6 +170,7 @@ module Schemas
|
|
140
170
|
self.some_record_array = some_record_array
|
141
171
|
self.some_record_map = some_record_map
|
142
172
|
self.some_enum_array = some_enum_array
|
173
|
+
self.some_optional_enum = some_optional_enum
|
143
174
|
end
|
144
175
|
|
145
176
|
# @override
|
@@ -165,7 +196,8 @@ module Schemas
|
|
165
196
|
'some_optional_record' => @some_optional_record&.to_h,
|
166
197
|
'some_record_array' => @some_record_array.map { |v| v&.to_h },
|
167
198
|
'some_record_map' => @some_record_map.transform_values { |v| v&.to_h },
|
168
|
-
'some_enum_array' => @some_enum_array.map { |v| v&.to_h }
|
199
|
+
'some_enum_array' => @some_enum_array.map { |v| v&.to_h },
|
200
|
+
'some_optional_enum' => @some_optional_enum&.to_h
|
169
201
|
}
|
170
202
|
end
|
171
203
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deimos-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro_turf
|