Module: Deimos::SchemaClass

Defined in:
lib/deimos/schema_class.rb,
sig/defs.rbs

Overview

Backwards-compatible shim. Schema class generation moved to the avro-gen-ruby gem (namespace AvroGen). Previously-generated classes that reference Deimos::SchemaClass::Record / Enum / Base still resolve here, with a one-time deprecation warning, via const_missing.

Defined Under Namespace

Classes: Base, Enum, Record

Constant Summary collapse

DEPRECATED_CONSTANTS =
{
  Base: AvroGen::SchemaClass::Base,
  Record: AvroGen::SchemaClass::Record,
  Enum: AvroGen::SchemaClass::Enum
}.freeze
GENERATION_SETTINGS =

The generation settings that live under Deimos.config.avrogen and are forwarded to AvroGen.config (same names on both sides).

%i(
  generated_class_path
  nest_child_schemas
  use_full_namespace
  schema_namespace_map
).freeze

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object

Parameters:

  • name (Symbol)


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/deimos/schema_class.rb', line 27

def self.const_missing(name)
  klass = DEPRECATED_CONSTANTS[name]
  return super unless klass

  Deimos::Logging.deprecate(
    "Deimos::SchemaClass::#{name} is deprecated; use AvroGen::SchemaClass::#{name} instead. " \
    'Run `rake avro:upgrade` to update generated classes.'
  )
  # Define the constant so the warning is only emitted once.
  const_set(name, klass)
  klass
end