lib/cocina/generator/schema.rb in cocina-models-0.69.2 vs lib/cocina/generator/schema.rb in cocina-models-0.70.0

- old
+ new

@@ -45,13 +45,16 @@ def model_attributes schema_properties.map(&:generate).join("\n") end def types - type_properties_doc = schema_doc.properties['type'] - return '' if type_properties_doc.nil? || type_properties_doc.enum.nil? + type_schema_property = schema_properties.find { |schema_property| schema_property.key == 'type' } + return '' if type_schema_property.nil? - types_list = type_properties_doc.enum.map { |item| "'#{item}'" }.join(",\n ") + type_schema_doc = type_schema_property.schema_doc + return '' if type_schema_doc.enum.nil? + + types_list = type_schema_doc.enum.map { |item| "'#{item}'" }.join(",\n ") <<~RUBY include Checkable TYPES = [#{types_list}].freeze