Sha256: 3afa4cc2d3eeedc23526038bb9a09bd0517da2121a8a28c27303b2277f5bd1aa

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

require 'dry/validation'

module Chronicle
  module Schema
    module Validation
      class BaseContract < Dry::Validation::Contract
        option :edge_validator, default: -> { Chronicle::Schema::Validation::EdgeValidator.new }

        # I think this doesn't work for nested objects because
        # we don't enumerate all the properties and rely on the edgevalidator
        # to do the validation. Commenting out for now.
        # config.validate_keys = true

        attr_accessor :type_name

        def self.type(type_name)
          @type_name = type_name
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chronicle-core-0.3.2 lib/chronicle/schema/validation/base_contract.rb
chronicle-core-0.3.1 lib/chronicle/schema/validation/base_contract.rb
chronicle-core-0.3.0 lib/chronicle/schema/validation/base_contract.rb