<commit_before>require 'dry/types/constraints'

require 'dry/validation/predicate_registry'
require 'dry/validation/schema_compiler'
require 'dry/validation/schema/key'
require 'dry/validation/schema/value'
require 'dry/validation/schema/check'

require 'dry/validation/error'
require 'dry/validation/result'
require 'dry/validation/messages'
require 'dry/validation/error_compiler'
require 'dry/validation/hint_compiler'

require 'dry/validation/schema/deprecated'

module Dry
  module Validation
    class Schema
      extend Dry::Configurable

      NOOP_INPUT_PROCESSOR = -> input { input }

      setting :path
      setting :predicates, Types::Predicates
      setting :registry
      setting :messages, :yaml
      setting :messages_file
      setting :namespace
      setting :rules, []
      setting :checks, []
      setting :options, {}
      setting :type_map, {}
      setting :hash_type, :weak

      setting :input_processor, :noop
      setting :input_processor_map, {
        sanitizer: InputProcessorCompiler::Sanitizer.new,
        json: InputProcessorCompiler::JSON.new,
        form: InputProcessorCompiler::Form.new,
      }.freeze

      setting :type_specs, false

      def self.inherited(klass)
        super
        klass.config.options = klass.config.options.dup

        if registry
          klass.config.registry = registry.new(self)
        else
          klass.set_registry!<commit_msg>Inherit registry only for custom schemas<commit_after>require 'dry/types/constraints'

require 'dry/validation/predicate_registry'
require 'dry/validation/schema_compiler'
require 'dry/validation/schema/key'
require 'dry/validation/schema/value'
require 'dry/validation/schema/check'

require 'dry/validation/error'
require 'dry/validation/result'
require 'dry/validation/messages'
require 'dry/validation/error_compiler'
require 'dry/validation/hint_compiler'

require 'dry/validation/schema/deprecated'

module Dry
  module Validation
    class Schema
      extend Dry::Configurable

      NOOP_INPUT_PROCESSOR = -> input { input }

      setting :path
      setting :predicates, Types::Predicates
      setting :registry
      setting :messages, :yaml
      setting :messages_file
      setting :namespace
      setting :rules, []
      setting :checks, []
      setting :options, {}
      setting :type_map, {}
      setting :hash_type, :weak

      setting :input_processor, :noop
      setting :input_processor_map, {
        sanitizer: InputProcessorCompiler::Sanitizer.new,
        json: InputProcessorCompiler::JSON.new,
        form: InputProcessorCompiler::Form.new,
      }.freeze

      setting :type_specs, false

      def self.inherited(klass)
        super
        klass.config.options = klass.config.options.dup

        if registry && self != Schema
          klass.config.registry = registry.new(self)
        else
          klass.set_registry!
{'fraction_non_alphanumeric': 0.09434616718695803, 'fraction_numerical': 0.0, 'mean_word_length': 3.191860465116279, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1978260', 'n_tokens_mistral': 827, 'n_tokens_neox': 794, 'n_words': 178}