deimos-ruby 1.23.2 → 1.24.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 +10 -0
- data/docs/CONFIGURATION.md +2 -1
- data/lib/deimos/config/configuration.rb +10 -1
- data/lib/deimos/instrumentation.rb +27 -22
- data/lib/deimos/utils/db_poller/base.rb +23 -0
- data/lib/deimos/utils/schema_class.rb +18 -3
- data/lib/deimos/version.rb +1 -1
- data/lib/generators/deimos/schema_class_generator.rb +9 -2
- data/regenerate_test_schema_classes.rb +13 -2
- data/spec/active_record_batch_consumer_spec.rb +1 -1
- data/spec/active_record_consumer_spec.rb +1 -1
- data/spec/active_record_producer_spec.rb +1 -1
- data/spec/batch_consumer_spec.rb +1 -1
- data/spec/consumer_spec.rb +2 -2
- data/spec/generators/schema_class_generator_spec.rb +18 -1
- data/spec/schemas/com/my-namespace/my-suborg/MyLongNamespaceSchema.avsc +18 -0
- data/spec/schemas/my_namespace/generated.rb +1 -1
- data/spec/schemas/my_namespace/my_long_namespace_schema.rb +48 -0
- data/spec/schemas/my_namespace/my_nested_schema.rb +1 -1
- data/spec/schemas/my_namespace/my_schema.rb +1 -1
- data/spec/schemas/my_namespace/my_schema_with_circular_reference.rb +1 -1
- data/spec/schemas/my_namespace/my_schema_with_complex_type.rb +2 -2
- data/spec/schemas/my_namespace/my_updated_schema.rb +2 -1
- data/spec/schemas/{request → my_namespace/request}/create_topic.rb +2 -2
- data/spec/schemas/{request → my_namespace/request}/index.rb +2 -2
- data/spec/schemas/{request → my_namespace/request}/update_request.rb +2 -2
- data/spec/schemas/{response → my_namespace/response}/create_topic.rb +2 -2
- data/spec/schemas/{response → my_namespace/response}/index.rb +2 -2
- data/spec/schemas/{response → my_namespace/response}/update_response.rb +2 -2
- data/spec/snapshots/consumers-no-nest.snap +44 -0
- data/spec/snapshots/consumers.snap +44 -0
- data/spec/snapshots/consumers_and_producers-no-nest.snap +44 -0
- data/spec/snapshots/consumers_and_producers.snap +44 -0
- data/spec/snapshots/consumers_circular-no-nest.snap +44 -0
- data/spec/snapshots/consumers_circular.snap +44 -0
- data/spec/snapshots/consumers_complex_types-no-nest.snap +44 -0
- data/spec/snapshots/consumers_complex_types.snap +44 -0
- data/spec/snapshots/consumers_nested-no-nest.snap +44 -0
- data/spec/snapshots/consumers_nested.snap +44 -0
- data/spec/snapshots/namespace_folders.snap +254 -210
- data/spec/snapshots/namespace_map.snap +1450 -0
- data/spec/snapshots/producers_with_key-no-nest.snap +44 -0
- data/spec/snapshots/producers_with_key.snap +44 -0
- data/spec/utils/db_poller_spec.rb +42 -0
- metadata +20 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 391cad2b23e7a6ef37106dcc5403af4ef5b62a82c1a6189e712fb3bc339613d1
|
4
|
+
data.tar.gz: 2bbb4468ee975158489ea797ee67c636d1c5da88cda8b10b33923b4410459178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48f37dc3bf2d016bc8806ccf26def976af003a4a8ebd46dad37e080fdeb9489f0bd3993747feda26a6e37d997b24f169554bb587e8d7ca88af6de85cf41851dd
|
7
|
+
data.tar.gz: ccee77567b4599bacc341e25f8c653a3f4ce21252c39dfb9849ffc2005fe44dc58aaa23537bb636f1545b1a691156225f66e1a909949b0bafb8440efa5269c4e
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## UNRELEASED
|
9
9
|
|
10
|
+
# 1.24.0 - 2024-02-26
|
11
|
+
|
12
|
+
***BREAKING CHANGE****
|
13
|
+
|
14
|
+
- Feature: Rename configuration option `generate_namespace_folders` to `use_full_namespace`. This will now use the entire namespace when generating schema classes
|
15
|
+
- Feature: Add configuration option `schema_namespace_map` to enable full control over the namespace for generated schema classes. Requires `use_full_namespace`
|
16
|
+
|
17
|
+
# 1.23.3 - 2024-01-25
|
18
|
+
- Feature: Add configuration to skip messages that are too large to publish via DB poller.
|
19
|
+
|
10
20
|
# 1.23.2 - 2024-01-22
|
11
21
|
- Fix: Send a `publish_error` metric for errors other than `DeliveryFailed`.
|
12
22
|
|
data/docs/CONFIGURATION.md
CHANGED
@@ -210,7 +210,8 @@ schema.path|nil|Local path to find your schemas.
|
|
210
210
|
schema.use_schema_classes|false|Set this to true to use generated schema classes in your application.
|
211
211
|
schema.generated_class_path|`app/lib/schema_classes`|Local path to generated schema classes.
|
212
212
|
schema.nest_child_schemas|false|Set to true to nest subschemas within the generated class for the parent schema.
|
213
|
-
schema.
|
213
|
+
schema.use_full_namespace|false|Set to true to generate folders for schemas matching the full namespace.
|
214
|
+
schema.schema_namespace_map|{}|A map of namespace prefixes to base module name(s). Example: { 'com.mycompany.suborg' => ['SchemaClasses'] }. Requires `use_full_namespace` to be true.
|
214
215
|
|
215
216
|
## Database Producer Configuration
|
216
217
|
|
@@ -380,7 +380,13 @@ module Deimos # rubocop:disable Metrics/ModuleLength
|
|
380
380
|
|
381
381
|
# Set to true to generate folders matching the last part of the schema namespace.
|
382
382
|
# @return [Boolean]
|
383
|
-
setting :
|
383
|
+
setting :use_full_namespace, false
|
384
|
+
|
385
|
+
# Use this option to reduce nesting when using use_full_namespace.
|
386
|
+
# For example: { 'com.mycompany.suborg' => 'SchemaClasses' }
|
387
|
+
# would replace a prefixed with the given key with the module name SchemaClasses.
|
388
|
+
# @return [Hash]
|
389
|
+
setting :schema_namespace_map, {}
|
384
390
|
end
|
385
391
|
|
386
392
|
# The configured metrics provider.
|
@@ -500,6 +506,9 @@ module Deimos # rubocop:disable Metrics/ModuleLength
|
|
500
506
|
# The number of times to retry production when encountering a *non-Kafka* error. Set to nil
|
501
507
|
# for infinite retries.
|
502
508
|
setting :retries, 1
|
509
|
+
# If true, rather than shutting down when finding a message that is too large, log an
|
510
|
+
# error and skip it.
|
511
|
+
setting :skip_too_large_messages, false
|
503
512
|
# Amount of time, in seconds, to wait before catching updates, to allow transactions
|
504
513
|
# to complete but still pick up the right records. Should only be set for time-based mode.
|
505
514
|
setting :delay_time, 2
|
@@ -43,6 +43,32 @@ module Deimos
|
|
43
43
|
|
44
44
|
# This module listens to events published by RubyKafka.
|
45
45
|
module KafkaListener
|
46
|
+
# @param exception [Exception]
|
47
|
+
def self.handle_exception_with_messages(exception)
|
48
|
+
messages = exception.failed_messages
|
49
|
+
messages.group_by(&:topic).each do |topic, batch|
|
50
|
+
producer = Deimos::Producer.descendants.find { |c| c.topic == topic }
|
51
|
+
next if batch.empty? || !producer
|
52
|
+
|
53
|
+
decoder = Deimos.schema_backend(schema: producer.config[:schema],
|
54
|
+
namespace: producer.config[:namespace])
|
55
|
+
payloads = batch.map { |m| decoder.decode(m.value) }
|
56
|
+
|
57
|
+
Deimos.config.metrics&.increment(
|
58
|
+
'publish_error',
|
59
|
+
tags: %W(topic:#{topic}),
|
60
|
+
by: payloads.size
|
61
|
+
)
|
62
|
+
Deimos.instrument(
|
63
|
+
'produce_error',
|
64
|
+
producer: producer,
|
65
|
+
topic: topic,
|
66
|
+
exception_object: exception,
|
67
|
+
payloads: payloads
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
46
72
|
# Listens for any exceptions that happen during publishing and re-publishes
|
47
73
|
# as a Deimos event.
|
48
74
|
# @param event [ActiveSupport::Notifications::Event]
|
@@ -52,28 +78,7 @@ module Deimos
|
|
52
78
|
return unless exception
|
53
79
|
|
54
80
|
if exception.respond_to?(:failed_messages)
|
55
|
-
|
56
|
-
messages.group_by(&:topic).each do |topic, batch|
|
57
|
-
producer = Deimos::Producer.descendants.find { |c| c.topic == topic }
|
58
|
-
next if batch.empty? || !producer
|
59
|
-
|
60
|
-
decoder = Deimos.schema_backend(schema: producer.config[:schema],
|
61
|
-
namespace: producer.config[:namespace])
|
62
|
-
payloads = batch.map { |m| decoder.decode(m.value) }
|
63
|
-
|
64
|
-
Deimos.config.metrics&.increment(
|
65
|
-
'publish_error',
|
66
|
-
tags: %W(topic:#{topic}),
|
67
|
-
by: payloads.size
|
68
|
-
)
|
69
|
-
Deimos.instrument(
|
70
|
-
'produce_error',
|
71
|
-
producer: producer,
|
72
|
-
topic: topic,
|
73
|
-
exception_object: exception,
|
74
|
-
payloads: payloads
|
75
|
-
)
|
76
|
-
end
|
81
|
+
handle_exception_with_messages(exception)
|
77
82
|
else
|
78
83
|
Deimos.config.metrics&.increment(
|
79
84
|
'publish_error',
|
@@ -105,6 +105,25 @@ module Deimos
|
|
105
105
|
raise Deimos::MissingImplementationError
|
106
106
|
end
|
107
107
|
|
108
|
+
# @param exception [Exception]
|
109
|
+
# @param batch [Array<ActiveRecord::Base>]
|
110
|
+
# @param status [PollStatus]
|
111
|
+
# @param span [Object]
|
112
|
+
# @return [Boolean]
|
113
|
+
def handle_message_too_large(exception, batch, status, span)
|
114
|
+
Deimos.config.logger.error("Error publishing through DB Poller: #{exception.message}")
|
115
|
+
if @config.skip_too_large_messages
|
116
|
+
Deimos.config.logger.error("Skipping messages #{batch.map(&:id).join(', ')} since they are too large")
|
117
|
+
Deimos.config.tracer&.set_error(span, exception)
|
118
|
+
status.batches_errored += 1
|
119
|
+
true
|
120
|
+
else # do the same thing as regular Kafka::Error
|
121
|
+
sleep(0.5)
|
122
|
+
false
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# rubocop:disable Metrics/AbcSize
|
108
127
|
# @param batch [Array<ActiveRecord::Base>]
|
109
128
|
# @param status [PollStatus]
|
110
129
|
# @return [Boolean]
|
@@ -118,6 +137,9 @@ module Deimos
|
|
118
137
|
process_batch(batch)
|
119
138
|
Deimos.config.tracer&.finish(span)
|
120
139
|
status.batches_processed += 1
|
140
|
+
rescue Kafka::BufferOverflow, Kafka::MessageSizeTooLarge,
|
141
|
+
Kafka::RecordListTooLarge => e
|
142
|
+
retry unless handle_message_too_large(e, batch, status, span)
|
121
143
|
rescue Kafka::Error => e # keep trying till it fixes itself
|
122
144
|
Deimos.config.logger.error("Error publishing through DB Poller: #{e.message}")
|
123
145
|
sleep(0.5)
|
@@ -139,6 +161,7 @@ module Deimos
|
|
139
161
|
end
|
140
162
|
true
|
141
163
|
end
|
164
|
+
# rubocop:enable Metrics/AbcSize
|
142
165
|
|
143
166
|
# Publish batch using the configured producers
|
144
167
|
# @param batch [Array<ActiveRecord::Base>]
|
@@ -10,10 +10,25 @@ module Deimos
|
|
10
10
|
# @return [Array<String>]
|
11
11
|
def modules_for(namespace)
|
12
12
|
modules = ['Schemas']
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
namespace_override = nil
|
14
|
+
module_namespace = namespace
|
15
|
+
|
16
|
+
if Deimos.config.schema.use_full_namespace
|
17
|
+
if Deimos.config.schema.schema_namespace_map.present?
|
18
|
+
namespace_keys = Deimos.config.schema.schema_namespace_map.keys.sort_by { |k| -k.length }
|
19
|
+
namespace_override = namespace_keys.find { |k| module_namespace.include?(k) }
|
20
|
+
end
|
21
|
+
|
22
|
+
if namespace_override.present?
|
23
|
+
# override default module
|
24
|
+
modules = Array(Deimos.config.schema.schema_namespace_map[namespace_override])
|
25
|
+
module_namespace = module_namespace.gsub(/#{namespace_override}\.?/, '')
|
26
|
+
end
|
27
|
+
|
28
|
+
namespace_folders = module_namespace.split('.').map { |f| f.underscore.camelize }
|
29
|
+
modules.concat(namespace_folders) if namespace_folders.any?
|
16
30
|
end
|
31
|
+
|
17
32
|
modules
|
18
33
|
end
|
19
34
|
|
data/lib/deimos/version.rb
CHANGED
@@ -121,9 +121,16 @@ module Deimos
|
|
121
121
|
@main_class_definition = class_template
|
122
122
|
|
123
123
|
file_prefix = schema.name.underscore.singularize
|
124
|
-
if Deimos.config.schema.
|
125
|
-
|
124
|
+
if Deimos.config.schema.use_full_namespace
|
125
|
+
# Use entire namespace for folders
|
126
|
+
# but don't add directories that are already in the path
|
127
|
+
directories = @modules.map(&:underscore).select do |m|
|
128
|
+
Deimos.config.schema.generated_class_path.exclude?(m)
|
129
|
+
end
|
130
|
+
|
131
|
+
file_prefix = "#{directories.join('/')}/#{file_prefix}"
|
126
132
|
end
|
133
|
+
|
127
134
|
filename = "#{Deimos.config.schema.generated_class_path}/#{file_prefix}.rb"
|
128
135
|
template(SCHEMA_CLASS_FILE, filename, force: true)
|
129
136
|
end
|
@@ -21,8 +21,11 @@ Deimos.configure do |deimos_config|
|
|
21
21
|
deimos_config.schema.path = "spec/schemas"
|
22
22
|
deimos_config.schema.backend = :avro_validation
|
23
23
|
deimos_config.schema.generated_class_path = './spec/schemas'
|
24
|
-
deimos_config.schema.
|
25
|
-
deimos_config.schema.
|
24
|
+
deimos_config.schema.use_full_namespace = true
|
25
|
+
deimos_config.schema.schema_namespace_map = {
|
26
|
+
'com' => 'Schemas',
|
27
|
+
'com.my-namespace.my-suborg' => %w(Schemas MyNamespace)
|
28
|
+
}
|
26
29
|
|
27
30
|
consumer do
|
28
31
|
class_name 'MyConsumer'
|
@@ -56,6 +59,14 @@ Deimos.configure do |deimos_config|
|
|
56
59
|
key_config field: :test_id
|
57
60
|
end
|
58
61
|
|
62
|
+
consumer do
|
63
|
+
class_name 'MyConsumer'
|
64
|
+
topic 'MyTopic'
|
65
|
+
schema 'MyLongNamespaceSchema'
|
66
|
+
namespace 'com.my-namespace.my-suborg'
|
67
|
+
key_config field: :test_id
|
68
|
+
end
|
69
|
+
|
59
70
|
producer do
|
60
71
|
class_name 'MyConsumer'
|
61
72
|
topic 'MyTopic'
|
@@ -143,7 +143,7 @@ module ActiveRecordConsumerTest
|
|
143
143
|
before(:each) do
|
144
144
|
Deimos.configure do |config|
|
145
145
|
config.schema.use_schema_classes = use_schema_classes
|
146
|
-
config.schema.
|
146
|
+
config.schema.use_full_namespace = true
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
@@ -71,7 +71,7 @@ describe Deimos::ActiveRecordProducer do
|
|
71
71
|
before(:each) do
|
72
72
|
Deimos.configure do |config|
|
73
73
|
config.schema.use_schema_classes = use_schema_classes
|
74
|
-
config.schema.
|
74
|
+
config.schema.use_full_namespace = true
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
data/spec/batch_consumer_spec.rb
CHANGED
data/spec/consumer_spec.rb
CHANGED
@@ -31,7 +31,7 @@ module ConsumerTest
|
|
31
31
|
before(:each) do
|
32
32
|
Deimos.configure do |config|
|
33
33
|
config.schema.use_schema_classes = use_schema_classes
|
34
|
-
config.schema.
|
34
|
+
config.schema.use_full_namespace = true
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -138,7 +138,7 @@ module ConsumerTest
|
|
138
138
|
before(:each) do
|
139
139
|
Deimos.configure do |config|
|
140
140
|
config.schema.use_schema_classes = true
|
141
|
-
config.schema.
|
141
|
+
config.schema.use_full_namespace = true
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -217,13 +217,30 @@ RSpec.describe Deimos::Generators::SchemaClassGenerator do
|
|
217
217
|
|
218
218
|
context 'with namespace folders' do
|
219
219
|
it 'should generate the correct classes' do
|
220
|
-
Deimos.with_config('schema.
|
220
|
+
Deimos.with_config('schema.use_full_namespace' => true) do
|
221
221
|
described_class.start
|
222
222
|
expect(files).to match_snapshot('namespace_folders', snapshot_serializer: MultiFileSerializer)
|
223
223
|
end
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
+
context 'with namespace map' do
|
228
|
+
it 'should generate the correct classes' do
|
229
|
+
Deimos.with_config(
|
230
|
+
{
|
231
|
+
'schema.use_full_namespace' => true,
|
232
|
+
'schema.schema_namespace_map' => {
|
233
|
+
'com' => 'Schemas',
|
234
|
+
'com.my-namespace.my-suborg' => %w(Schemas MyNamespace)
|
235
|
+
}
|
236
|
+
}
|
237
|
+
) do
|
238
|
+
described_class.start
|
239
|
+
expect(files).to match_snapshot('namespace_map', snapshot_serializer: MultiFileSerializer)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
227
244
|
context 'nested true' do
|
228
245
|
it 'should generate the correct classes' do
|
229
246
|
Deimos.with_config('schema.nest_child_schemas' => true) do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"namespace": "com.my-namespace.my-suborg",
|
3
|
+
"name": "MyLongNamespaceSchema",
|
4
|
+
"type": "record",
|
5
|
+
"doc": "Test schema",
|
6
|
+
"fields": [
|
7
|
+
{
|
8
|
+
"name": "test_id",
|
9
|
+
"type": "string",
|
10
|
+
"doc": "test string"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"name": "some_int",
|
14
|
+
"type": "int",
|
15
|
+
"doc": "test int"
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
+
module Schemas; module MyNamespace
|
5
|
+
### Primary Schema Class ###
|
6
|
+
# Autogenerated Schema for Record at com.my-namespace.my-suborg.MyLongNamespaceSchema
|
7
|
+
class MyLongNamespaceSchema < Deimos::SchemaClass::Record
|
8
|
+
|
9
|
+
### Attribute Accessors ###
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :test_id
|
12
|
+
# @return [Integer]
|
13
|
+
attr_accessor :some_int
|
14
|
+
|
15
|
+
# @override
|
16
|
+
def initialize(test_id: nil,
|
17
|
+
some_int: nil)
|
18
|
+
super
|
19
|
+
self.test_id = test_id
|
20
|
+
self.some_int = some_int
|
21
|
+
end
|
22
|
+
|
23
|
+
# @override
|
24
|
+
def schema
|
25
|
+
'MyLongNamespaceSchema'
|
26
|
+
end
|
27
|
+
|
28
|
+
# @override
|
29
|
+
def namespace
|
30
|
+
'com.my-namespace.my-suborg'
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.tombstone(key)
|
34
|
+
record = self.allocate
|
35
|
+
record.tombstone_key = key
|
36
|
+
record.test_id = key
|
37
|
+
record
|
38
|
+
end
|
39
|
+
|
40
|
+
# @override
|
41
|
+
def as_json(_opts={})
|
42
|
+
{
|
43
|
+
'test_id' => @test_id,
|
44
|
+
'some_int' => @some_int
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end; end
|
@@ -9,7 +9,7 @@ module Schemas; module MyNamespace
|
|
9
9
|
### Secondary Schema Classes ###
|
10
10
|
# Autogenerated Schema for Record at com.my-namespace.ARecord
|
11
11
|
class ARecord < Deimos::SchemaClass::Record
|
12
|
-
|
12
|
+
|
13
13
|
### Attribute Accessors ###
|
14
14
|
# @return [String]
|
15
15
|
attr_accessor :a_record_field
|
@@ -185,7 +185,7 @@ module Schemas; module MyNamespace
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def self.tombstone(key)
|
188
|
-
record = self.
|
188
|
+
record = self.allocate
|
189
189
|
record.tombstone_key = key
|
190
190
|
record.test_id = key
|
191
191
|
record
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module MyNamespace
|
4
|
+
module Schemas; module Com; module MyNamespace
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.MySchema
|
7
7
|
class MyUpdatedSchema < Schemas::MyNamespace::MySchema
|
@@ -16,3 +16,4 @@ module Schemas; module MyNamespace
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module Request
|
4
|
+
module Schemas; module MyNamespace; module Request
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.request.CreateTopic
|
7
7
|
class CreateTopic < Deimos::SchemaClass::Record
|
@@ -33,4 +33,4 @@ module Schemas; module Request
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end; end
|
36
|
+
end; end; end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module Request
|
4
|
+
module Schemas; module MyNamespace; module Request
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.request.Index
|
7
7
|
class Index < Deimos::SchemaClass::Record
|
@@ -33,4 +33,4 @@ module Schemas; module Request
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end; end
|
36
|
+
end; end; end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module Request
|
4
|
+
module Schemas; module MyNamespace; module Request
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.request.UpdateRequest
|
7
7
|
class UpdateRequest < Deimos::SchemaClass::Record
|
@@ -33,4 +33,4 @@ module Schemas; module Request
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end; end
|
36
|
+
end; end; end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module Response
|
4
|
+
module Schemas; module MyNamespace; module Response
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.response.CreateTopic
|
7
7
|
class CreateTopic < Deimos::SchemaClass::Record
|
@@ -33,4 +33,4 @@ module Schemas; module Response
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end; end
|
36
|
+
end; end; end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module Response
|
4
|
+
module Schemas; module MyNamespace; module Response
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.response.Index
|
7
7
|
class Index < Deimos::SchemaClass::Record
|
@@ -33,4 +33,4 @@ module Schemas; module Response
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end; end
|
36
|
+
end; end; end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# This file is autogenerated by Deimos, Do NOT modify
|
4
|
-
module Schemas; module Response
|
4
|
+
module Schemas; module MyNamespace; module Response
|
5
5
|
### Primary Schema Class ###
|
6
6
|
# Autogenerated Schema for Record at com.my-namespace.response.UpdateResponse
|
7
7
|
class UpdateResponse < Deimos::SchemaClass::Record
|
@@ -33,4 +33,4 @@ module Schemas; module Response
|
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end; end
|
36
|
+
end; end; end
|
@@ -267,6 +267,50 @@ module Schemas
|
|
267
267
|
end
|
268
268
|
|
269
269
|
|
270
|
+
spec/app/lib/schema_classes/my_long_namespace_schema.rb:
|
271
|
+
# frozen_string_literal: true
|
272
|
+
|
273
|
+
# This file is autogenerated by Deimos, Do NOT modify
|
274
|
+
module Schemas
|
275
|
+
### Primary Schema Class ###
|
276
|
+
# Autogenerated Schema for Record at com.my-namespace.my-suborg.MyLongNamespaceSchema
|
277
|
+
class MyLongNamespaceSchema < Deimos::SchemaClass::Record
|
278
|
+
|
279
|
+
### Attribute Accessors ###
|
280
|
+
# @return [String]
|
281
|
+
attr_accessor :test_id
|
282
|
+
# @return [Integer]
|
283
|
+
attr_accessor :some_int
|
284
|
+
|
285
|
+
# @override
|
286
|
+
def initialize(test_id: nil,
|
287
|
+
some_int: nil)
|
288
|
+
super
|
289
|
+
self.test_id = test_id
|
290
|
+
self.some_int = some_int
|
291
|
+
end
|
292
|
+
|
293
|
+
# @override
|
294
|
+
def schema
|
295
|
+
'MyLongNamespaceSchema'
|
296
|
+
end
|
297
|
+
|
298
|
+
# @override
|
299
|
+
def namespace
|
300
|
+
'com.my-namespace.my-suborg'
|
301
|
+
end
|
302
|
+
|
303
|
+
# @override
|
304
|
+
def as_json(_opts={})
|
305
|
+
{
|
306
|
+
'test_id' => @test_id,
|
307
|
+
'some_int' => @some_int
|
308
|
+
}
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
|
270
314
|
spec/app/lib/schema_classes/my_nested_record.rb:
|
271
315
|
# frozen_string_literal: true
|
272
316
|
|