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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 945958ca7b49192f533a47eac766f4ca463d7ed85702b2c85b41fc22d8aaeef1
4
- data.tar.gz: 8e7a6bf75f733d1903810a85e6ccf0185a868d8dbc07a1544d210bb160135417
3
+ metadata.gz: c57c2700b01b998f358cb4e96ee6e6b2c1c8c32936d741b2371182a6017f7adc
4
+ data.tar.gz: 440bf25b629ba34da51cd1c0a1b443858bcd4ca270fed800b6e277c050b0741f
5
5
  SHA512:
6
- metadata.gz: 220de8bc9a38b50affdc56e0f25c6a185ffc1646cf39de21478b6906fc1fcf3bf20c197d4105132ecc7cae004e75498299ebc104fcb8d46f530fe8a67ac92883
7
- data.tar.gz: fd89136dea1f76acb4de3bda22ee06e1d5ef88dc827a2690b588d2e84284584041818bbb257b71db99212586005a4b6818f89e8f627dc727e2eb8ba1b144c94f
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
@@ -28,7 +28,8 @@ module Deimos
28
28
  schemas_path: Deimos.config.schema.path,
29
29
  user: Deimos.config.schema.user,
30
30
  password: Deimos.config.schema.password,
31
- namespace: @namespace
31
+ namespace: @namespace,
32
+ logger: Deimos.config.logger
32
33
  )
33
34
  end
34
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deimos
4
- VERSION = '1.12.6'
4
+ VERSION = '1.13.0'
5
5
  end
@@ -62,6 +62,8 @@ module Deimos
62
62
  [schema.values]
63
63
  elsif schema.respond_to?(:items)
64
64
  [schema.items]
65
+ elsif schema.respond_to?(:schemas)
66
+ schema.schemas
65
67
  else
66
68
  []
67
69
  end
@@ -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
@@ -90,6 +90,17 @@
90
90
  "symbols": ["sym1", "sym2"]
91
91
  }
92
92
  }
93
+ },
94
+ {
95
+ "name": "some_optional_enum",
96
+ "type": [
97
+ "null",
98
+ {
99
+ "type": "enum",
100
+ "name": "AnotherEnum",
101
+ "symbols": ["sym3", "sym4"]
102
+ }
103
+ ]
93
104
  }
94
105
  ]
95
106
  }
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.12.6
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-14 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro_turf