Skip to content

Commit

Permalink
update the bulkrax factory to support flexible metadata while maintai…
Browse files Browse the repository at this point in the history
…ning non-flexi support (#1001)

* update the bulkrax factory to support flexible metadata while maintaining non-flexi support

* better compatibility
  • Loading branch information
orangewolf authored Dec 20, 2024
1 parent 5ae568a commit d5b64bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/factories/bulkrax/valkyrie_object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def self.field_multi_value?(field:, model:)
return false unless field_supported?(field: field, model: model)

if model.respond_to?(:schema)
dry_type = model.schema.key(field.to_sym)
schema = model.new.singleton_class.schema || model.schema
dry_type = schema.key(field.to_sym)
return true if dry_type.respond_to?(:primitive) && dry_type.primitive == Array

false
Expand Down Expand Up @@ -193,7 +194,8 @@ def self.schema_properties(klass)
@schema_properties_map ||= {}

klass_key = klass.name
@schema_properties_map[klass_key] = klass.schema.map { |k| k.name.to_s } unless @schema_properties_map.key?(klass_key)
schema = klass.new.singleton_class.schema || klass.schema
@schema_properties_map[klass_key] = schema.map { |k| k.name.to_s } unless @schema_properties_map.key?(klass_key)

@schema_properties_map[klass_key]
end
Expand Down

0 comments on commit d5b64bc

Please sign in to comment.