Sha256: f61a814e5f1518b2b6d14484e14f2a9bdc8460d17575f0f3412abfe7b75ae491

Contents?: true

Size: 613 Bytes

Versions: 20

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true
require 'shopify_cli'

module Extension
  module Tasks
    module Converters
      module ValidationErrorConverter
        FIELD_FIELD = 'field'
        MESSAGE_FIELD = 'message'

        def self.from_array(context, errors)
          return [] if errors.nil?
          context.abort(context.message('tasks.errors.parse_error')) unless errors.is_a?(Array)

          errors.map do |error|
            Models::ValidationError.new(
              field: error[FIELD_FIELD],
              message: error[MESSAGE_FIELD]
            )
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shopify-cli-1.6.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.5.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.4.1 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.4.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.3.1 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.3.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.2.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.1.2 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.1.1 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.1.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.0.5 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.0.4 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.0.3 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.0.2 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.0.1 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-1.0.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-0.9.3 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-0.9.2 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-0.9.1 lib/project_types/extension/tasks/converters/validation_error_converter.rb
shopify-cli-0.9.0 lib/project_types/extension/tasks/converters/validation_error_converter.rb