Module: Hyrax::Workflow::WorkflowImporter::SchemaValidator

Defined in:
app/services/hyrax/workflow/workflow_importer.rb

Class Method Summary collapse

Class Method Details

.call(data:, schema:, logger:) ⇒ Object

Returns true if the data validates from the schema.

Parameters:

  • data (Hash)
  • schema (#call)

Returns:

  • true if the data validates from the schema

Raises:

  • Exceptions::InvalidSchemaError if the data does not validate against the schema



170
171
172
173
174
175
176
# File 'app/services/hyrax/workflow/workflow_importer.rb', line 170

def self.call(data:, schema:, logger:)
  result = schema.call(data)
  return true if result.success?
  message = result.messages(full: true).inspect
  logger.error(message)
  raise message
end