Class: Deimos::Generators::SchemaClassGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Deimos::Generators::SchemaClassGenerator
- Defined in:
- lib/generators/deimos/schema_class_generator.rb
Overview
Generator for Schema Classes used for the IDE and consumer/producer interfaces
Constant Summary collapse
- SPECIAL_TYPES =
%i(record enum).freeze
- INITIALIZE_WHITESPACE =
"\n#{' ' * 19}"
- IGNORE_DEFAULTS =
%w(message_id timestamp).freeze
- SCHEMA_CLASS_FILE =
'schema_class.rb'
- SCHEMA_RECORD_PATH =
File.('schema_class/templates/schema_record.rb.tt', __dir__).freeze
- SCHEMA_ENUM_PATH =
File.('schema_class/templates/schema_enum.rb.tt', __dir__).freeze
Instance Method Summary collapse
-
#generate ⇒ Object
:nodoc:.
Instance Method Details
#generate ⇒ Object
:nodoc:
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/generators/deimos/schema_class_generator.rb', line 131 def generate _validate Rails.logger.info("Generating schemas from Deimos.config to #{Deimos.config.schema.generated_class_path}") Deimos.config.producer_objects.each do |config| schema_name = config.schema namespace = config.namespace || Deimos.config.producers.schema_namespace key_schema_name = config.key_config[:schema] generate_classes(schema_name, namespace, key_schema_name) end Deimos.config.consumer_objects.each do |config| schema_name = config.schema namespace = config.namespace key_schema_name = config.key_config[:schema] generate_classes(schema_name, namespace, key_schema_name) end end |