Module: Hyrax::Workflow::WorkflowImporter::SchemaValidator
- Defined in:
- app/services/hyrax/workflow/workflow_importer.rb
Class Method Summary collapse
-
.call(data:, schema:, logger:) ⇒ Boolean
True if the data validates from the schema.
- .format_message(result) ⇒ String
Class Method Details
.call(data:, schema:, logger:) ⇒ Boolean
Returns true if the data validates from the schema.
169 170 171 172 173 174 175 |
# File 'app/services/hyrax/workflow/workflow_importer.rb', line 169 def self.call(data:, schema:, logger:) result = schema.call(data) return true if result.success? = (result) logger.error() raise end |
.format_message(result) ⇒ String
181 182 183 184 185 186 187 188 |
# File 'app/services/hyrax/workflow/workflow_importer.rb', line 181 def self.(result) = result.errors(full: true).map do |msg| "Error on workflow entry #{msg.path}\n\t#{msg.text}\n\tGot: #{msg.input || '[no entry]'}" end << "Input was:\n\t#{result.to_h}" .join("\n") end |