Skip to content

Commit

Permalink
Merge pull request #6659 from samvera/improve-utility-of-hash-definit…
Browse files Browse the repository at this point in the history
…ions

keep the config info handy so you can do things like DigitalInstantia…
  • Loading branch information
dlpierce authored Feb 2, 2024
2 parents 74079d2 + 83372b4 commit 653cb61
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/services/hyrax/simple_schema_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SimpleSchemaLoader
# types
def attributes_for(schema:)
definitions(schema).each_with_object({}) do |definition, hash|
hash[definition.name] = definition.type
hash[definition.name] = definition.type.meta(definition.config)
end
end

Expand Down
9 changes: 9 additions & 0 deletions spec/services/hyrax/simple_schema_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
depositor: Valkyrie::Types::String)
end

it 'provides access to attribute metadata' do
expect(schema_loader.attributes_for(schema: :core_metadata)[:title].meta)
.to include({ "type" => "string",
"form" => { "multiple" => true, "primary" => true, "required" => true },
"index_keys" => ["title_sim", "title_tesim"],
"multiple" => true,
"predicate" => "http://purl.org/dc/terms/title" })
end

context 'with generated resource' do
it 'provides an attributes hash' do
expect(schema_loader.attributes_for(schema: :sample_metadata))
Expand Down

0 comments on commit 653cb61

Please sign in to comment.