Skip to content

surfliner_schema: add initial Reader & HyraxLoader

kibigo! requested to merge surfliner_schema-implementation into trunk

Adds SurflinerSchema::Reader, which is intended to be an easier interface for interacting with schemas in a Surfliner context than the Hyrax::SimpleSchemaLoader (which takes a schema: argument we don’t use), then creates a SurflinerSchema::HyraxLoader wrapper class to provide a similar interface to Hyrax::SimpleSchemaLoader (for use with Hyrax methods in e.g. Comet.)

The hope is that SurflinerSchema::HyraxLoader can be a near–drop-in replacement for EnvSchemaLoader in Comet; the only thing missing is that it does not actually read from the environment (so one would need

SurflinerSchema::HyraxLoader.for_schemas(
  *ENV["METADATA_MODELS"].to_s.split(",").map(&:to_sym)
)

as currently implemented).

Adds tests for both of these, which use a spec/fixtures/core_schema.yml file inspired by the config/metadata/core_metadata.yaml file in Hyrax.

It is easy enough to expand this metadata format beyond what Hyrax supports and add methods to SurflinerSchema::Reader to access, for example, mapping information (as superskunk might require).

Followup to !1997 (merged); the rest of #974 (closed)?

Edited by kibigo!

Merge request reports