Skip to content

Commit

Permalink
CCOL-2039: Evaluate schemaclass schema and namespace when setting dec…
Browse files Browse the repository at this point in the history
…oder
  • Loading branch information
Lionel Pereira committed Dec 18, 2023
1 parent ceff055 commit b61a403
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/deimos/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ class Consumer
class << self
# @return [Deimos::SchemaBackends::Base]
def decoder
@decoder ||= Deimos.schema_backend(schema: config[:schema],
namespace: config[:namespace])
# @decoder ||= Deimos.schema_backend(schema: config[:schema], namespace: config[:namespace])

return @decoder if @decoder

@decoder = if Utils::SchemaClass.use?(config.to_h)
schema_class = "Schemas::#{config[:schema]}".constantize.new
Deimos.schema_backend(schema: schema_class.schema, namespace: schema_class.namespace)
else
Deimos.schema_backend(schema: config[:schema], namespace: config[:namespace])
end
end

# @return [Deimos::SchemaBackends::Base]
Expand Down

0 comments on commit b61a403

Please sign in to comment.