Sha256: 728baef537d5a51f8862a0ae5d838d5cdb587cfbc820756cc84a10685941e8f4

Contents?: true

Size: 704 Bytes

Versions: 6

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

namespace :wcc_contentful do
  desc 'Validates content types in your space against the validations defined on your models'
  task :validate, :environment do |_t|
    # Ensure application models are loaded before we validate
    Rails.application.eager_load!

    client = Services.instance.management_client ||
      Services.instance.client

    content_types = client.content_types(limit: 1000).items

    content_types = WCC::Contentful::ModelValidators
      .transform_content_types_for_validation(content_types)

    errors = WCC::Contentful::Model.schema.call(content_types)
    raise WCC::Contentful::ValidationError, errors.errors unless errors.success?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wcc-contentful-app-0.4.0.pre.rc lib/tasks/validate.rake
wcc-contentful-app-0.4.0.pre.alpha lib/tasks/validate.rake
wcc-contentful-app-0.3.0.pre.rc3 lib/tasks/validate.rake
wcc-contentful-app-0.3.0.pre.rc2 lib/tasks/validate.rake
wcc-contentful-app-0.3.0.pre.rc lib/tasks/validate.rake
wcc-contentful-app-0.2.2 lib/tasks/validate.rake