Module: CurationConcerns::Workflow::WorkflowImporter::SchemaValidator

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

Class Method Summary collapse

Class Method Details

.call(data:, schema:) ⇒ 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



96
97
98
99
100
# File 'app/services/curation_concerns/workflow/workflow_importer.rb', line 96

def self.call(data:, schema:)
  validation = schema.call(data)
  return true unless validation.messages.present?
  raise validation.messages.inspect
end